LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using dll, Hwnd Pointer

I am using "call library function node" to connect with a dll of a hardware vendor of a USB camera. I need to provide a certain function a pointer to Hwnd object. I beleive I need to put an image control on my user interface and somehow connect its block to my "call library function node". My question is how can I provide the function the pointer to the image control?

Roy
0 Kudos
Message 1 of 7
(6,582 Views)


roy@start-art.co.il wrote:
I am using "call library function node" to connect with a dll of a hardware vendor of a USB camera. I need to provide a certain function a pointer to Hwnd object. I beleive I need to put an image control on my user interface and somehow connect its block to my "call library function node". My question is how can I provide the function the pointer to the image control?

Roy

You can't get a HWND from a LabVIEW control. They are not implemented as Windows child window but are instead entirely handled by LabVIEW internally. The only thing in LabVIEW that has an associated Windows handle are the panels itself. So what you could do is create a VI that has an empty frontpanel and a minimalistic event handling loop and then integrate that as a sub panel into your main VI. With the VI Utils library you can also get from this site you can then retrieve the Windows handle of your subpanel VI as an int32 and pass that to your library. Of course use of sub panels will require you to have at least LabVIEW 7.0.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 7
(6,576 Views)

Hello Rolf,

Thank you for your quick reply.

Can you direct me to a sample of similar solution using subpanels in order to get the hwnd?

May you have somthing of your own? or an other source like help or manual with some more detail how to do this?

Thx,

Roy

0 Kudos
Message 3 of 7
(6,572 Views)
The question should be which window handle do you need to provide. Providing the hwnd of the image control itself is probably not useful unless the DLL knows specifically how to interact with that control. If you only need the window handle of the window where this will be displayed, you can do that by calling FindWindow, as shown in the attached. If you're expected to use an ActiveX control for this, you might be able to get its handle as one of its properties.

___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(6,566 Views)


@tst wrote:
The question should be which window handle do you need to provide. Providing the hwnd of the image control itself is probably not useful unless the DLL knows specifically how to interact with that control. If you only need the window handle of the window where this will be displayed, you can do that by calling FindWindow, as shown in the attached. If you're expected to use an ActiveX control for this, you might be able to get its handle as one of its properties.

This is mostly correct. However please note that the image control does not have a HWND at all. All native LabVIEW controls are entirely handled internal to LabVIEW and Windows is not aware at all that there is something like a control inside a LabVIEW panel. LabVIEW uses Windows HWNDs only for its windows, both front panels and block diagrams.  The exception to this are Active X controls that of course need to use a HWND somehow in order to work as Windows requires them to do.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 7
(6,561 Views)
My point was that if the DLL expects an hwnd for a specific control, it will also need to know exactly how to interact with that control, and that my guess was either that the DLL only wants the handle of the entire window, or that it expects a specific kind of control which can (maybe) be placed in an AX container.

___________________
Try to take over the world!
0 Kudos
Message 6 of 7
(6,559 Views)


@tst wrote:
My point was that if the DLL expects an hwnd for a specific control, it will also need to know exactly how to interact with that control, and that my guess was either that the DLL only wants the handle of the entire window, or that it expects a specific kind of control which can (maybe) be placed in an AX container.

I'm pretty sure it simply expects a HWND where it will bitblit the image into. If it would expect an ActiveX control it would most probably already be an ActiveX control itself.

Rolf Kalbermatter

Message Edited by rolfk on 07-10-2006 12:16 PM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 7 of 7
(6,552 Views)