Omgili, forum search, forums search, search forums, discussion search,discussions search, search discussions, board search, boards search, search boards
  Advanced Search

How to wrap a callback for VB6

On Fri, 12 Jun 2009 21:31:12 +0200, Hans Achim <...@gmx.de

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



On Fri, 12 Jun 2009 18:23:13 -0400, "Bob Riemersma" <...@nil.net

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.

"Hans Achim" <...@TK2MSFTNGP04.phx.gbl...

On Fri, 12 Jun 2009 18:30:49 -0400, "Jim Mack" <...@mdxi.nospam.com

The standard way to recieve callbacks is using AddressOf for a Sub in
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?

--
Jim Mack
Twisted tees at http://www.cafepress.com/2050inc
"We sew confusion"

On Fri, 12 Jun 2009 18:23:22 -0400, "MikeD" <...@nowhere.edu

"Hans Achim" <...@TK2MSFTNGP04.phx.gbl...

You can use the AddressOf operator to pass a function pointer to the DLL.
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


Discussion Title: How to wrap a callback for VB6
Title Keywords: wrap  callback