Exception in fetching stencil paths

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

Hi Vicky -

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.]
--------------------

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