Visio Automation Exception in GetStencilPaths()

V

vicky

Hi All!
I am developing a VC++ project for automating MS-Visio 2003, when i
am
trying to get stencil paths using function GetStencilPaths(), i have
following error:
COleException. SCODE: 800706ba.
I am working on Windows-XP (SP2), Visual Studio 6.0 and Visio-2003.
I am using following code to automate Visio:
//
***************************************************************************
***************************
CLSID
visio_clsid=
{ 0x00021a20, 0x0000, 0x0000, { 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x46 } };
IUnknown *pUnk=
NULL;
IVApplication
app;
GetActiveObject(visio_clsid, NULL,
&pUnk);
IDispatch *pDisp =
NULL;
if ( pUnk !=
NULL )
pUnk->QueryInterface(IID_IDispatch, (LPVOID *)
&pDisp);
if ( pDisp ==
NULL )
{
if ( !app.CreateDispatch
(visio_clsid) )
{
return -2;
}
}

else
{
app.AttachDispatch
(pDisp);
}

app.SetVisible(TRUE); //Visio invoked and
visible.
CString strStencilPaths = app.GetStencilPaths(); //Problem occurrs
on
this line.
CString strXaStencilFolder = "c:\
\My_Stencil_Folder";
//Check if path is already
there,
if (strstr(strStencilPaths, strXaStencilFolder) ==
NULL)
{
strStencilPaths +=
";";
strStencilPaths +=
strXaStencilFolder;
app.SetStencilPaths
(strStencilPaths);
}

//
***************************************************************************
***************************
What causes this problem? Thanks in anticipation.
Regards,
Vicky
 
B

Barb Way

Cross-posting response ..
In case you are still seeking info on this part of the Visio API, I think
what you are searching for is the "StencilPaths" property, which is
read/write. You can review the materials on MSDN to get more info on its
use :
http://msdn.microsoft.com/en-us/library/ms426386.aspx

Hope that helps!

Barb Way
Product Support - Visio
Microsoft Corporation
[This posting is provided "As Is" with no warranties, and confers no
rights.]
--------------------
From: vicky <[email protected]>
Newsgroups: microsoft.public.visio.troubleshoot
Subject: Visio Automation Exception in GetStencilPaths()
Date: Tue, 25 Nov 2008 04:12:29 -0800 (PST)
Organization: http://groups.google.com
Lines: 69
Message-ID:
<ff475a22-958a-4e4b-bcc9-29fc10504e7a@o40g2000prn.googlegroups.com>
NNTP-Posting-Host: 59.90.65.11
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1227615149 20552 127.0.0.1 (25 Nov 2008
12:12:29 GMT)
X-Complaints-To: (e-mail address removed)
NNTP-Posting-Date: Tue, 25 Nov 2008 12:12:29 +0000 (UTC)
Complaints-To: (e-mail address removed)
Injection-Info: o40g2000prn.googlegroups.com; posting-host=59.90.65.11;
posting-account=uj0ZrAoAAACK9QQSia5riIWT7g75MWe6
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.3.154.9
Safari/525.19,gzip(gfe),gzip(gfe)
Bytes: 2688
Path:
TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTFEEDS01.phx.gbl!newsfeed0
0.sul.t-online.de!t-online.de!border2.nntp.dca.giganews.com!nntp.giganews.co
m!postnews.google.com!o40g2000prn.googlegroups.com!not-for-mail
Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.visio.troubleshoot:496
X-Tomcat-NG: microsoft.public.visio.troubleshoot

Hi All!
I am developing a VC++ project for automating MS-Visio 2003, when i
am
trying to get stencil paths using function GetStencilPaths(), i have
following error:
COleException. SCODE: 800706ba.
I am working on Windows-XP (SP2), Visual Studio 6.0 and Visio-2003.
I am using following code to automate Visio:
//
***************************************************************************
***************************
CLSID
visio_clsid=
{ 0x00021a20, 0x0000, 0x0000, { 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x46 } };
IUnknown *pUnk=
NULL;
IVApplication
app;
GetActiveObject(visio_clsid, NULL,
&pUnk);
IDispatch *pDisp =
NULL;
if ( pUnk !=
NULL )
pUnk->QueryInterface(IID_IDispatch, (LPVOID *)
&pDisp);
if ( pDisp ==
NULL )
{
if ( !app.CreateDispatch
(visio_clsid) )
{
return -2;
}
}

else
{
app.AttachDispatch
(pDisp);
}

app.SetVisible(TRUE); //Visio invoked and
visible.
CString strStencilPaths = app.GetStencilPaths(); //Problem occurrs
on
this line.
CString strXaStencilFolder = "c:\
\My_Stencil_Folder";
//Check if path is already
there,
if (strstr(strStencilPaths, strXaStencilFolder) ==
NULL)
{
strStencilPaths +=
";";
strStencilPaths +=
strXaStencilFolder;
app.SetStencilPaths
(strStencilPaths);
}

//
***************************************************************************
***************************
What causes this problem? Thanks in anticipation.
Regards,
Vicky
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top