Solved

Manage VB6 callback problem with external C DLL

Posted on 2010-11-20
2
557 Views
Last Modified: 2012-05-10
 Hi experts!

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.

Please help.
0
Comment
Question by:dvplayltd
2 Comments
 
LVL 13

Accepted Solution

by:
gbanik earned 500 total points
ID: 34183841
Have you considered writing a simple C wrapper around the C DLL? There may be now various ways to communicate with your VB6 code.
0
 

Author Closing Comment

by:dvplayltd
ID: 34192625
thanks.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question