|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to wrap a callback for VB6Hello!
I have a Windows dll which can be easily used in VB6 using a tlb. However, this Windows dll raises callbacks, and I haven't found an easy way to receive them in VB6. Being quite frustrated, I was thinking about an odder solution: Would it be a good idea to make an ActiveX in C++ that I can call from VB6 and which will raise the callback in VB6?? Thank you for suggestions. Regards, Achim I'd assume the solution involves a callback routine declared in a static
(BAS) module, then passing a pointer to it via the AddressOf operator in VB6. Show quoteHide quote "Hans Achim" <h.ac***@gmx.de> wrote in message news:eYP$6S56JHA.5828@TK2MSFTNGP04.phx.gbl... > Hello! > > I have a Windows dll which can be easily used in VB6 using a tlb. > However, this Windows dll raises callbacks, and I haven't found an easy > way to receive them in VB6. > Being quite frustrated, I was thinking about an odder solution: > > Would it be a good idea to make an ActiveX in C++ that I can call from VB6 > and which will raise the callback in VB6?? > > Thank you for suggestions. > > Regards, > Achim "Hans Achim" <h.ac***@gmx.de> wrote in message You can use the AddressOf operator to pass a function pointer to the DLL. news:eYP$6S56JHA.5828@TK2MSFTNGP04.phx.gbl... > Hello! > > I have a Windows dll which can be easily used in VB6 using a tlb. > However, this Windows dll raises callbacks, and I haven't found an easy > way to receive them in VB6. > Being quite frustrated, I was thinking about an odder solution: > > Would it be a good idea to make an ActiveX in C++ that I can call from VB6 > and which will raise the callback in VB6?? > You can read more about the AddressOf operator here: http://msdn.microsoft.com/en-us/library/aa242738(VS.60).aspx However, I wouldn't call the ActiveX idea "odd". In fact, it might be better and easier. -- Mike Hans Achim wrote:
> Hello! The standard way to recieve callbacks is using AddressOf for a Sub in> > I have a Windows dll which can be easily used in VB6 using a tlb. > However, this Windows dll raises callbacks, and I haven't found an > easy way to receive them in VB6. > Being quite frustrated, I was thinking about an odder solution: > > Would it be a good idea to make an ActiveX in C++ that I can call > from VB6 and which will raise the callback in VB6?? a standard module. But there are gotchas, and some of them won't be solved by having an intermediary. If your intermediary can raise events in VB rather than just passing on a call, you'll eliminate almost every problem. What types of parameters are sent to the called-back function? Does the callback originate on a separate thread? |
|||||||||||||||||||||||