LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

sending a function address from vb6 to labwin

How can I implement a link between a VB6 GUI and a LabWindows DLL, such that while the LW DLL is doing a task, it can periodically update a progress bar in VB? 
 
I believe I have the basic idea:
[VB]
1.  Use the 'addressof' operator to send the address of the vb function I want to call from LW (to update the progress bar).
2.  Make sure the 'callback' function in VB is in a BAS module.
 
[LW]
1.  Export the function in LW that will be receiving the VB functiion address
2.  Generate the DECLARE statement for the exported function to be used by VB.
 
Am I on the right track here?  If so, I'm not sure about the exact syntax to create the DECLARE statement in VB, since it will contain a function pointer in the parameter list.
 
Also, on the LW side, how is the function pointer variable created?  Currently, I'm using "typedef int (*MyFuncPtr) (int iProgress)".  Although it compiles, I don't get the correct address from VB.
 
Do you have a simple example on how to implement this?  I would prefer not to have to resort to a full-blown DDE interface for such a simple task.
 
Regards,
 
Dan
 
 
 
0 Kudos
Message 1 of 2
(2,865 Views)
Hi Toreador,

Here are two links that can get you started on the LabWindows/CVI side.

Exporting Variables and Functions from a DLL in LabWindows/CVI
Pointer to a Function Forum Post

As for the VB6 side of things I do believe it is possible to pass a VB function to a DLL and suggest looking at the Microsoft Developer's Network website. There are lots of helpful examples and tutorials there.


Adam

National Instruments
Applications Engineer
0 Kudos
Message 2 of 2
(2,836 Views)