Tim
Thu Jul 19 12:45:55 CDT 2007
The exposed events are documented in the link included in my reply.
Tim
"mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
news:uWQFttiyHHA.464@TK2MSFTNGP02.phx.gbl...
> ninefofo wrote:
>> The ConnectObject is my trouble. How would I do that in VB6?
>>
>
> hi Ninefofo,
>
> Tim Williams is right. The "WithEvents" declaration goes along
> with referencing the object's typelib in your (vb) project.
>
> Then vb can use the typelib to set up any event handlers that
> you want.
>
> But then, if you are going to reference the typelib, you may as
> well just use "early-binding" rather than "late-binding" (i.e.,
> just forget about CreateObject).
>
> Scripting is different from vb in that all objects are "late-
> bound" (except for the intrinsic built-in objects). And so
> you have the WScript.CreateObject that includes connecting
> to events, or ConnectObject for those situations where you
> are getting access to an object some other way.
>
> While you would be well advised to follow Tim Williams advice
> and use "WithEvents", there is a way to connect events in vb
> _WITHOUT_ access to the typelib.
>
> It involves examining the ole interface (from code, of course),
> and winds up doing the same thing as scripting's ConnectObject,
> except in a different way.
>
> If you want to check it out (for extreme techies only), read
> Carlo Randone's: "COM: Handle Late-bound Events within Visual
> Basic Using an ATL Bridge" (with code), found here:
>
>
http://msdn.microsoft.com/msdnmag/issues/01/03/connpoints/
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but,
> no guarantee the answers will be applicable to the questions)
>