LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

"The Handle is Invalid" When trying to access DLL function

Hello All,

 

I uploaded an ActiveX Controller to access a Barometer DLL, of which im trying get pressure data.

 

HRESULT    error1=0;

HRESULT    error2=0;
HRESULT    error3=0;
HRESULT    error4=0;

CAObjHandle val0=-1;

 

//HRESULT CVIFUNC BarometerClientDLL__BarometerClientSetserverName (CAObjHandle objectHandle, ERRORINFO *errorInfo, const char *pRetVal);

error1 =  BarometerClientDLL__BarometerClientSetserverName (val0, NULL, IP_ADDRESS);

 

//HRESULT CVIFUNC BarometerClientDLL__BarometerClientSetserverSocket (CAObjHandle objectHandle, ERRORINFO *errorInfo,long pRetVal); 
error2 =  BarometerClientDLL__BarometerClientSetserverSocket (val0, NULL, PORT_NUM);

 

//HRESULT CVIFUNC BarometerClientDLL__BarometerClientreconnect (CAObjHandle objectHandle, ERRORINFO *errorInfo, VBOOL *pRetVal);
error3 =  BarometerClientDLL__BarometerClientreconnect (val0, NULL, retVal0);

 

//HRESULT CVIFUNC BarometerClientDLL__BarometerClientGetpsia (CAObjHandle objectHandle,ERRORINFO *errorInfo,double *pRetVal);  
error4 =  BarometerClientDLL__BarometerClientGetpsia (val0, NULL, retVal);

 

 

 

 

The code compiles fine, but after each of the above lines execute, the error1-4 is set to -214702890 and the value in reads: {0x80070006="The handle is invalid."}

 

The Barometer DLL doesnt need any parameters or UI control so I tried setting the Object Handle to 0, and Error Info to NULL, I wasnt able to find much info on this error anywhere online and I am not using TestSteps.

 

Thank you for help

0 Kudos
Message 1 of 4
(4,339 Views)

Hey VladSimontov,

 

Did you use the wizard to create the code for the ActiveX controller http://digital.ni.com/public.nsf/allkb/4B597F188B89B6DD862568970071F2FC  or did you used this DLL from somewhere else?

Has this DLL ever worked before? 

 

Please let me know.

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

Yes, I used the ActiveX control wizard to set up .fp folder from a .tlb. The original program is a C# DLL. And yes the DLL is currently being used by VB6/C# applications.

 

Thank you!

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

Hey VladSimontov,

 

It could be that the ActiveX control is not supported by CVI for this DLL. Can you try on another computer too? What does this DLL supposed to do exactly?

Can you send me a screen shot of the error that you get?"the handle is invalid". Let me know. Can you call any other DLLs through ActiveX controls?

 

FYI:http://forums.ni.com/t5/LabWindows-CVI/Some-methods-was-missing-after-using-ActiveX-Controller-Wizar...

 

 

 

 

National Instruments
Applications Engineer
0 Kudos
Message 4 of 4
(4,286 Views)