|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Event handling (C# vs VB6.0)I have the following code in C# to "sink" an event with an event
handler. Obj.OnCallEvent +=new CallEventHandler(obj_OnCallEvent); obj_OnCallEvent being the actual method and "obj.OnCallEvent" is the actual event. This events are provided by a 3rd party Dll. I have converted that dll into a type library and used it in VB6.0 However, I'm not sure how to "sink" events in VB6.0! Please advise what would be a compatible statement in VB6.0 for above C# code? If you have it wrapped properly, you are most of the way there. In the
object declaration, add with Events (Dim with Events objectName as TypeofWrapper). It is then a matter of matching the interface. You should see the events on the COM wrapper and be able to bind to them. -- Show quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA ************************************************* Think outside of the box! ************************************************* <sandeep.rauku***@gmail.com> wrote in message news:1158755384.784935.3400@m73g2000cwd.googlegroups.com... >I have the following code in C# to "sink" an event with an event > handler. > > Obj.OnCallEvent +=new CallEventHandler(obj_OnCallEvent); > > obj_OnCallEvent being the actual method and "obj.OnCallEvent" is the > actual event. > > This events are provided by a 3rd party Dll. > > I have converted that dll into a type library and used it in VB6.0 > > However, I'm not sure how to "sink" events in VB6.0! > > Please advise what would be a compatible statement in VB6.0 for above > C# code? > sandeep.rauku***@gmail.com wrote:
Show quote > I have the following code in C# to "sink" an event with an event You'll need to have a class or form level variable declare WithEvents> handler. > > Obj.OnCallEvent +=new CallEventHandler(obj_OnCallEvent); > > obj_OnCallEvent being the actual method and "obj.OnCallEvent" is the > actual event. > > This events are provided by a 3rd party Dll. > > I have converted that dll into a type library and used it in VB6.0 > > However, I'm not sure how to "sink" events in VB6.0! > > Please advise what would be a compatible statement in VB6.0 for above > C# code? (e.g. Dim WithEvents Obj as TargetObject). You'll then be able to write a function called Obj_OnCallEvent (or similar) which handles the event. This is assuming that the event is one that VB can hook up to - e.g. that it is declared in a COM interface as an event (IIRC). Damien |
|||||||||||||||||||||||