ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get a pointer to a VI

I am using an ActiveX control that wants me to provide a pointer to the location of a sub routine.  The subroutine processes information passed back by the ActiveX control. How would this be coded in LV?  In C++, it looks like the code below:

 

 

int ProcessFile(const char *filein)
{
SetOutputHandler(myOutputHandler);

// addtional calls to ActiveX to process filein

}

 

 

 

void myOutputHandler(int type,int param)
{
  // routine to process tyep and param
}

 

So to sum it up, how do I create  myOutputHandler in LV and provide the ActiveX control a pointer to it?

0 Kudos
Message 1 of 4
(3,197 Views)
Only way to get a pointer to a vi is to build the vi into a dll, and use
loadlibrary and getprocaddress to get a pointer to the function.

There is actually another way, that uses .NET to get a pointer to a callback
that is inserted into a com object or something like that. I don't have any
experiance with that though.

Regards,

Wiebe.


0 Kudos
Message 2 of 4
(3,160 Views)

Hi there

 

if the control exports an event then you can use the "register event callback" function. This will let you pass a VI reference to a vi that will be called when the event arrives.

 

Can you post some code (including the control)?

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 3 of 4
(3,151 Views)

No.... unfortunatly no event is returned by the .dll.   It insists that I pass it a pointer and the it will decide when my code will be called.  I tossed that particular software in the trash and am going with a software vendor that is a bit more complient in the ways of coding.

 

I looked at the .net stuff as well as it might have worked with the whole delegate and proxy, but again decided it was too much trouble.

 

Thanks for the feedback!

0 Kudos
Message 4 of 4
(3,119 Views)