01-14-2015 10:31 AM
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?
01-14-2015 11:15 AM
@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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-14-2015 12:28 PM
Just use the parent VI panel instead.
The external code most likely looking for a Window to be used as owner window.
01-11-2016 12:43 PM
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.
01-11-2016 01:00 PM
Have you tried to use the parent VI panel instead ?
01-11-2016 05:47 PM
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.
01-11-2016 08:33 PM
01-12-2016 02:27 AM - edited 01-12-2016 02:28 AM
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.
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.