LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

help accessing custom control in ocx

Hello,

I have a custom control written in VB6 that I cannot get to work with
in LabWindows. The control has been stripped down to no dependencies
and has only a single public function that raises a message box and
returns a constant number.

In CVI, I can create the control on a .uir, make an .fp file for the
control using the ActiveX controller wizard, and call the function of
the ocx. The call does not show the message box, it does not return
the constant, and it does not return an error.

The control is called MeasCtrl in the following, my main looks like
this:

#include
#include "MeasCtrl.h"
#include "InstrumControl.h"
#include
#include
#include "test.h"

static int panelHandle;
static CAObj
Handle measHandle = 0;
static CAObjHandle intHandle = 0;
short result;


int main (int argc, char *argv[])
{
HRESULT status;
measHandle = 0;

if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "test.uir", PANEL)) < 0)
return -1;

result = 1;


GetObjHandleFromActiveXCtrl (panelHandle, PANEL_OMXMEASCTRL,
&measHandle);

status = MeasCtrl__OMXMeasCtrlTest (measHandle, NULL, &result );

DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}


When the MeasCtrl_OMXMeasCtrlTest function is called, status = 0 ,
result = 1 (the function should return 3). measHandle is non zero. I
can trace the function call into the MeasCtrl.c file, and no errors
show up there either.


Any suggestions about what could be wrong with this? Is there
something I have to do to my control to make it work with CVI?
0 Kudos
Message 1 of 2
(3,117 Views)
Hello

if the call MeasCtrl__OMXMeasCtrlTest(), use the errorInfo structure instead of passing it null to see if the control is returning any other error messages. You can use CA_DisplayErrorInfo() to find out if anything else happened while calling the control.
Try calling it from another IDE like VB or VC++, just to sure everything works there too.
If it still's acting up, you can email your activex control and the cvi project from here, and I can test it out on my machine. You can reference me on the subject line as well.

Thanks

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 2
(3,117 Views)