> > > I'm trying to figure out how events are generated in VC++ ATL and then
> > > received in VB. I already have a working example to which I want to add an
[quoted text clipped - 55 lines]
> Thanks,
> Joachim
Oh, I was paying poor attention. <g>
Is this a component? ie, is something you 'drop' on a VB form?
As I have been using ATL and custom Addins (they handle all the details) for
so long, I'm not sure I am qualified to detect any apparent error in your
published code. It looks correct.
The IDL looks a little funny. Are you sure you have connected the method to
the interface?
But perhaps this might help. VB while avoiding many COM interfaces, supports
the usual in a very simple, if not practically 'transparent', manner. ie, if
you create a reference or add a component (the latter shows up on toolbox to
the left) and VB 'sees' it - offering an opportunity to select the event,
showing Intellisense, etc. Then it is the C++ side of things that is hosed.
Raw guess, your published interface is there, VB 'sees' a COM interface -
you just haven't 'connected' your method to it.
You may want to re-post in several of the VC++ newsgroups...
microsoft.public.vc. ...
Provide a snippet of your idl (coclass,...) and snippets from all headers
where you reference your event.
-ralph
Joachim - 12 Dec 2005 10:15 GMT
Thanks Ralph,
What do you think is wrong with the IDL? The library looks like this:
[
uuid(8DAFBF7E-46B0-40E9-87B3-8E5F61631159),
version(1.0),
helpstring("MYOWNLib 1.0 Type Library")
]
library MYOWNLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(6156B03D-186D-4DD1-AA48-92A92E5A5A72)
]
dispinterface _IEvents
{
properties:
methods:
/* A few other methods (that works!) */
...
[id(10)]
HRESULT Hover([in] BSTR someString);
};
The coclass looks like this:
[
uuid(3D010728-CFD8-4ED5-ADAA-DA455E92C008),
helpstring("Dummy Class"),
]
coclass Dummy
{
[default] interface IMyOwnInterface;
[default, source] interface _IEvents;
};
I call the class dummy since the real implementation is in a completely
different project where I have another class to implement the interface.
Any ideas where I could have forgot about the connection? (I'll give a link
to this thread from the vc.atl discussion group as well - the discussion in
vc.atl can be found at
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.vc.atl&tid
=4bb89a6f-4776-46c0-9a81-406aadfde67c&lang=en&cr=US&p=1)
> > > > I'm trying to figure out how events are generated in VC++ ATL and then
> > > > received in VB. I already have a working example to which I want to
[quoted text clipped - 83 lines]
>
> -ralph
vivekuniq - 12 Dec 2005 10:59 GMT
did u add "withEvents" while declaring the object?
Dim WithEvents Obj As IMyATL
long time before i forgot to add this "withevents" in the client and i was
searching too much in the IDL.
-vivek
Joachim - 15 Dec 2005 14:29 GMT
Thanks Mr vivekuniq,
It is an object which I dragged in the GUI only. It is not declared at all
like that.
Joachim
> did u add "withEvents" while declaring the object?
>
[quoted text clipped - 4 lines]
>
> -vivek