Events in VC 6.0

H

Haakon S.

I'm trying to pick up events via AddAdvise in the Visio ActiveX Control. I
use Visual C++ 6.0. The veventlist. h file has the following definition:

CVEvent AddAdvise(short EventCode, const VARIANT& SinkIUnkOrIDisp, LPCTSTR
IIDSink, LPCTSTR TargetArgs);

How do I create the SinkIUnkOrDisp object?
 
C

Chris Roth [MVP]

God Dag Haakon,

I'm no good with C++ but here's a couple of ideas:

1. Did you look at examples in the Visio SDK?

Visio 2003
http://www.microsoft.com/downloads/...bd-b0bb-46e7-936a-b8539898d44d&DisplayLang=en
Visio 2007
http://www.microsoft.com/downloads/...b8-5ef7-4e6e-a582-c8d6b5ee4e33&displaylang=en

2. I think you need to get the Visio Application object from the Visio
Control first. The Visio application "lives inside" of the control, and once
you get to it, you can program against it just like you would with regular
Visio. Here's one way to get it (C#)

Visio.Application visApp;
visApp = visControl.Window.Application




--
Hope this helps,

Chris Roth
Visio MVP

Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/
 
H

Haakon S.

Thank you for the quick reply.

Getting det CEventlist object is not a problem. It is the arguments passed
into the funtion that is the headache. I find it strange that I maybe have to
add a number of other files to my project, such as addsink.h which in turn
require Visio.h. Then I'm deep into the Visio program itself rather than the
ActiveX control.

Could you PLEASE direct this question to somebody at MS that is familiar
with both Visio and VC++ so that I can have some boilerplate code for event
handling.

Btw, I have picked up some messages via BEGIN_EVENTSINK_MAP mechanism, but
that covers only a few events.
 
P

Paul Herber

Thank you for the quick reply.

Getting det CEventlist object is not a problem. It is the arguments passed
into the funtion that is the headache. I find it strange that I maybe have to
add a number of other files to my project, such as addsink.h which in turn
require Visio.h. Then I'm deep into the Visio program itself rather than the
ActiveX control.

Could you PLEASE direct this question to somebody at MS that is familiar
with both Visio and VC++ so that I can have some boilerplate code for event
handling.

Btw, I have picked up some messages via BEGIN_EVENTSINK_MAP mechanism, but
that covers only a few events.

As Chris said there are many examples in the SDK in the Libraries,
Samples, Tools and Wizards folders in C++, C# and VB

The .h files are required to get the constants used and required by
Visio e,g, the eventList parameters. It's only a couple of #includes
 

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