Solved

Manage VB6 callback problem with external C DLL

Posted on 2010-11-20
2
554 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now