Manage VB6 callback problem with external C DLL
Posted on 2010-11-20
I have a Vb6 application which call C DLL via _stdcall. I manage to rule this external hardware no matter of some limits of VB6, with exception of callback. Callback function do not works and I need to find a solution. Problem with callback function is that in Vb6 IDE it works fine, but in .exe file don’t work and make great crash (somethink even with blue screen :-) )
If I understand correct, problem is because the DLL calls these callback functions from other thread (for safety reason) and in this case VB6 can manage. More clear, I get callback function OK even in exe file, but if I try to read a parameters of this callback it crash. I need these parameters!
I can’t change my Vb6 because I already have many code ready.
I can’t change C DLL .because it is from external manufacturer.
Possible workaround is to create ActiveX OCX with C++ which manage this external DLL and to use this OCX in my VB6 application. Will this work ? I really need advice – MS VC 6.0 with sure will be able to work with these callback, but OCX is in same thread of VB6 application, then will or will not work?
Or what type of MS VC6 project I need which I can reference to Vb6 and to work ? I’m 10+ years professional programmer, but new to C and will be very bad to write this OCX a week or more just to find that I’m in the same situation.