Capabilities of Visio 2003 Automation

S

Scott Metzger

Hi,

I have a few questions about the capabilities of Automation in Visio
2003. With Visio 2002 Automation one cannot make a modal dialog with
respect to Visio when using Automation via a .exe. I have heard that
Visio 2003 will have an Active-X component included. Will this Active-X
component allow for:
1) Easy embeding of Visio in a .exe ?
2) Will I be able to create a modal dialog with respect to Visio via a
..exe ?

Thanks,
Scott Metzger
 
M

Markus Breugst

Hello Scott,

I do not have any experiences with Visio 2003. However, I have a workaround
for achieving modal dialogs:

Invoking the following operation "locks" Visio. That means, no user
interaction is possible anymore.
-----
_visioApplication.OnComponentEnterState(
VisOnComponentEnterCodes.visComponentStateModal |
VisOnComponentEnterCodes.visModalDisableVisiosFrame |
VisOnComponentEnterCodes.visModalDontBlockMessages, true );
-----

To unlock Visio, do the following:
-----
Application.Instance.VApp.OnComponentEnterState(
VisOnComponentEnterCodes.visComponentStateModal, false );
Application.Instance.VApp.OnComponentEnterState(
VisOnComponentEnterCodes.visComponentStateModal, false );
-----

No, I it's not a mistake that the statement above appears twice. Don't ask
me why, but you have to invoke it twice in order to make it work. (And don't
ask me how long it took to find out. ;-)

Hope this workaround helps.

Best regards,

Markus
 
M

Markus Breugst

Ups, copy&paste error:
Please substitute "Application.Instance.VApp" with your Visio 2002(!)
application object.
 
S

Scott Metzger

Thanks, that helps out alot.

I tried it out and it works. Also, I didn't need to 'unlock' it twice.
Maybe you are inadvertently 'locking' it twice.

Here is the C++ code using visiwrap that I used:

void CVisioReadDlg::OnBnClickedLock()
{
vsoApp.OnComponentEnterState((VisOnComponentEnterCodes)(
visComponentStateModal |
visModalDisableVisiosFrame |
visModalDontBlockMessages), true);
}

void CVisioReadDlg::OnBnClickedUnlock()
{
vsoApp.OnComponentEnterState(visComponentStateModal, false );
}
 
M

Markus Breugst

I tried it out and it works. Also, I didn't need to 'unlock' it twice.
Maybe you are inadvertently 'locking' it twice.

Well, even in this case it would be a funny effect.
It's more than a year ago that I implemented this locking thing. There was
one news contribution which said that invoking the unlock twice is needed if
you forget to unlock Visio before closing a previous run of the external
application (which is close to your suggestion). This did not match our
case, but however it helped. Anyhow, good to know that that it works even
without the second call. :)

Best regards,
Markus
 

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