LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Parent panel handle error

Hello,
 
I'm using labwindows/CVI to create a dll linked with VS2003 project (C++)
I want to use the hWnd of my VS2003 project as the parenthandle of the CVI panel (in function : LoadPanelEx(hWnd,..)
I have the following error :
"Error in call to LoadPanelEx.
Parent Panel Handle : 262856
UIR file name : essai.uir
Panel Resource ID : 1
hInstance : 0x10000000, C:\WINDOWS\system32\essai.dll
 
Error code : -4
Panel, pop-up, or menu bar handle is invalid"
 
 
NB : If i use LoadPanelEx(NULL,....) it is OK but the panel is not in the VS2003 Window.
 
Thanks by advance for your help.
Regards
 
0 Kudos
Message 1 of 7
(4,096 Views)
Hello Nicolas,
 
Would it be possible for you to attach the .uir file here, so that we can try to reproduce the problem? Also, it would be great if you could let us know which version of CVI you last used to modify the .uir, and what the version of c:\windows\system32\cvirte.dll is in the computer where you're seeing this error.
 
Thanks,
Luis
0 Kudos
Message 2 of 7
(4,080 Views)

According to my CVI 7.0 help file, the first parameter to LoadPanelEx() is a CVI panel handle, not a Windows handle. So I'm not sure this is the correct approach to get what you want.

JR

0 Kudos
Message 3 of 7
(4,075 Views)

Hello all,

thanks for your responses.

I agree with JR_2005, the handle expected in first parameter of LoadPanelEx is the CVI panel handle but I don't have such handle because VS2003 supply only hWnd handle.

I wanted believe that CVI, based on C compiler, could accept hWnd handle.

Concerning the CVI version, It's CVI 8.1.

Find enclosed the cvirte.dll and my .uir file.

Thanks.

 

0 Kudos
Message 4 of 7
(4,059 Views)

Hello all,

thanks for your responses.

I agree with JR_2005, the handle expected in first parameter of LoadPanelEx is the CVI panel handle but I don't have such handle because VS2003 supply only hWnd handle.

I wanted believe that CVI, based on C compiler, could accept hWnd handle.

Concerning the CVI version, It's CVI 8.1.

Find enclosed the cvirte.dll and my .uir file.

Thanks.

0 Kudos
Message 5 of 7
(4,058 Views)
hWnd do not have anything to do with C: they are Windows specific stuff regardless of the language used (be it C, Pascal, Java...).

but, i would expect the hmi library of cvi to provide functions to convert from hWnd to cvi handles and back, which obviously they don't.
(in fact, there is 1 function to convert from cvi handle to hWnd, but the documentation said it does not work for anything other than top level panel, so is kind of useless...)
0 Kudos
Message 6 of 7
(4,050 Views)
Hello Nicolas,
 
I'm sorry that I didn't read your original post very carefully. It should have been obvious to me what you were trying to do. Like JR pointed out, the reason you are getting this error is because you are not passing a CVI panel to a function that expects a CVI panel.
 
I understand that you would like to have the panel that you are loading be a "child" of the window created in Visual Studio. Unfortunately, that is not possible. You cannot insert the CVI user interface library objects (panels, controls, etc...) into other UI frameworks, such as MFC or .NET.
 
To answer dummy_decoy's point about converting between hwnds and panel handles: while there is an hwnd for every top-level CVI panel, the reverse isn't true (not every hwnd belongs to a CVI panel). So, even though you can obtain an hwnd from a panel, you can't do the reverse. To obtain an hwnd from a panel, use the following code:
 
GetPanelAttribute (panel, ATTR_SYSTEM_WINDOW_HANDLE, &hwnd);
 
Hope this helps,
 
Luis
 
0 Kudos
Message 7 of 7
(4,033 Views)