Showing results for 
Search instead for 
Did you mean: 

COM/ActiveX Register Event Callback Problem

@nathand wrote:

You could certainly try allocating memory for a struct of that size and passing a pointer to it to the ActiveX node, but I have no idea if it will work. I'm not sure that ActiveX calls share the same address space with their callers, nor how the Cstring parameter will work. I'd try allocating the Cstring as a pointer-sized integer but wouldn't be surprised if it causes your code to crash (save often). To allocate memory, use Call Library Function Node with the library name set to "LabVIEW" and the function set to DSNewPtr, which is described in the help and also in posts on this forum. If you need to pre-fill values into the allocated memory, then you should create a matching cluster and use MoveBlock. After the ActiveX call completes, use MoveBlock again to get the data into a format LabVIEW can use. There are examples of this on this forum, although they generally deal with a call to a DLL and not ActiveX.


It's worth a try but may not work. If you do try it and fail, upload your code, along with a specific description of the error that occurs. Do you have any more documentation about the functions you're trying to call? Can you upload the manual? Do they provide sample code in any language?

Hi Nathan,


Can you please upload  a VI which you've used DSNewPtr and MoveBlock.  I'm not sure if I'm defining the parameters correctly.  I looked at the documentation and some discussions in the forum, but they're not very clear.


Thanks a lot



EDIT: I just found this one:

It should help a lot. Thanks.

0 Kudos
Message 21 of 22

When you're setting up MoveBlock, you absolutely should be using the Variant structure, and ignore the USBPxxPARAMETERS structure you posted earlier. I don't know why Alligator support would have suggested you need that structure, but it is obvious from their sample code code that they are using a Variant, and copying individual values from the Variant into the parameters structure, for example:

void readLPFC (USBPxxPARAMETERS *d) {



pIUSBPxxS1Ctl->USBPxxS1Command(d->DeviceHandle, ID_READ_LPFC, &InVal, &OutVal);

d->LPFc = OutVal.fltVal;


The fltVal element is a member of the Variant structure, not of the parameters structure.

0 Kudos
Message 22 of 22