LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Windows Handle (hWnd) of a SubPanel VI

Ok, but both "Front Panel Window:OS Window" and "FP:Nativ Window" return NULL in a VI that is displayed in a sub-panel (1st sample of this post)...

So, really no way to get a handle of the VI in a sub-panel?

0 Kudos
Message 11 of 18
(2,545 Views)

@CAPTIC_LA wrote:

 

So, really no way to get a handle of the VI in a sub-panel?


I don't think there is one.  This is not a Child Parent relationship, well it is, just not as Windows defines windows.  I believe that Windows truly only sees the VI's panel that has the subpanel, and that one doesn't exist for the VI in the subpanel. 

0 Kudos
Message 12 of 18
(2,539 Views)

Just use the parent VI panel instead.

The external code most likely looking for a Window to be used as owner window.

 

 

George Zou
0 Kudos
Message 13 of 18
(2,536 Views)

I see that this topic is time consuming, but there is an alternative to run in a Sub-Panel a VI to use the dll to manage the windows hwnd. I have a general VI with a Sub-Panel, where I want to insert a VI that uses window management, but hwnd = 0. Any example or any way to solve this problem is there. Thanks a lot.

0 Kudos
Message 14 of 18
(2,419 Views)

Have you tried to use the parent VI panel instead ?

 

George Zou
0 Kudos
Message 15 of 18
(2,407 Views)

No, not be that is that. Sorry, but not be that you mean with to use the parent VI panel. Can you add a link or an example? Thanks a lot.

0 Kudos
Message 16 of 18
(2,386 Views)
You still have the same problem as I discussed in 2012, only windows that are open have handles. Technically, the front panel of VIs that are subpanels are not open -- hence no window 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 17 of 18
(2,374 Views)

mike is correct. A subPanel is not a window as far as Windows is concerned. So you can not write into it from a DLL.

 

There are only two ways for you to solve this. Both are more or less a crappy solution and I wouldn't do it in a production type application without insuring my ass with lots of legalize text. Smiley LOL

 

You can get the handle of the outer window and let the DLL draw into that one if it allows to define some offset. If it doesn't allow to set an offset into the window area where to draw into you can't use this approach since technically anything but the title bar in a LabVIEW window is client area and handled by LabVIEW itself. That means that the menu bar is NOT a window meny but drawn and handled by LabVIEW directly and your DLL would draw over that. You also can't have anything in the area the DLL considers its area to draw in, since LabVIEW will fight with the DLL what to show in that area with ugly flickering and disturbed image in the area.

 

The more complex solution is the create a window of your own using Windows API functions, install that as child window into the LabVIEW panel using more Windows API functions at any position in the panel you want and then pass that handle to the DLL. Still no overlapping possible but now the child window will simply mask out anything that may be underneath and it will also mask any drawing command of the DLL that happen to be outside its area, unless the DLL uses dirty direct draw or similar functions in an incorrect way.Don't forget to destroy that window at the end too before closing the LabVIEW VI, or you create a memory leak.

Rolf Kalbermatter
My Blog
0 Kudos
Message 18 of 18
(2,355 Views)