LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Windows Handle (hWnd) of a SubPanel VI

Is it possible to get a valid Windows handle of a VI that is running in a SubPanel? Windows Handle (hWnd) of a SubPanel VI. A call to FindWindowA returns 0 when a VI is running in a SubPanel.

Download All
0 Kudos
Message 1 of 18
(9,091 Views)

What is it that you are trying to accomplish? Why do you need the Windows Handle?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 18
(9,082 Views)

I am trying to display a video stream from a Sensoray 2250 framegrabber. The video stream function of the Sensoray SDK uses an hWnd to select a window for displaying the video stream. I would like the video stream to be part of, but not my entire GUI. I created a VI that calls the Sensoray SDK which works as an independent VI, but when placed in a subpanel it fails. I probed the hWnd of my VI in the subpanel and it returns "0". Smiley Sad

 

Any secret way to get at the hWnd of a vision control?

0 Kudos
Message 3 of 18
(9,067 Views)
The problem is that a front panel doesn't have a handle of its own. The function you are using is drawing in a Windows Window - not a LV front panel. You need to let it draw on the application window or find some other way of displaying the video.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 18
(9,059 Views)

It turns out that the Sensoray frame grabber works with IMAQdx. Smiley Happy This solves all my problems trying to interface with the 3rd party dll drivers. Now if I could just get back the last couple of days of my life.

Message 5 of 18
(9,048 Views)

Hey, you learned something. It's all good...

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 6 of 18
(9,045 Views)

Actually, LV front panel is a Windows window.  It has a titlebar, a frame and a client area.  And has window handle.

A subpanel might not be a window.  At least, not top level window, so FindWindow won't work.

 

 

George Zou
0 Kudos
Message 7 of 18
(9,034 Views)

I guess I wasn't clear. Of course a LV front panel is a Windows window with a window handle. But logically it is more. It is a place where LV objects live.
This DLL he was using could only relate to a LV front panel as a generic window. It couldn't know or care about what else might be there. I couldn't understand or participate in the logical structure that exists on a LV front panel with controls and indicators.
That is what I meant.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 18
(9,027 Views)

Hi everybody,

 

This is a quite old post but I would like to know if a solution has been found to this issue (getting a handle of the front panel of a subpanel VI).

I want to use an external library that needs a handle to display specific images/graphs.

It seems to be OK to get the handle of a "dialog based" VI but I would like to do this display in a subpanel VI...

Is there something like a "Get Child Window" or thing like that to get a vald handle?

 

Thanks for your help

 

Lionel

0 Kudos
Message 9 of 18
(8,503 Views)

To answer the question, yes there are ways of getting a HWND of a LabVIEW front panel.  The large majority of the time you don't really need this.  Most people are set in their ways of window manipulation, and don't realize that VI server has many of those functions built in, which are cross-platform so they should be used when possible.

 

But on the off chance that you want to do something VI server doesn't allow you can get the HWND a couple ways.  First you can use the FindWindowA function and pass VI Title.

 

But there is also a lesser known feature of LabVIEW that is only exposed when you have some debugging feature turned on, which allows you to get the HWND of a window.  Here is a thread discussing it.

 

https://lavag.org/topic/13803-getting-the-window-handle-for-a-fp-with-no-title-bar/

Message 10 of 18
(8,487 Views)