From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Child Window from Parent using WIN API

Solved!
Go to solution

Hello all,

I am using User32.dll to make a parent-child relationship between two VIs. I use SetParent function, and pass the handle of parent VI and child VI to this function. Now, after this relationship has been established, I want to remove the child window from the parent and use it as a independent VI using WIN API. Can anyone help me on this?

 

Thanks in advance!

 

Fragger Fox!

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 1 of 5
(5,350 Views)
Solution
Accepted by topic author FraggerFox

Hi Fragger Fox,

i think it should be possible if you assign a new parent to the child. Maybe it works if you assign the desktop as new parent.

 

Hope it helps.

Mike

Message 2 of 5
(5,348 Views)

@MikeS81 wrote:

Hi Fragger Fox,

i think it should be possible if you assign a new parent to the child. Maybe it works if you assign the desktop as new parent.

 

Hope it helps.

Mike


I am thinking if that would really work. Since the child already has a parent, just giving it a handle of other parent would make it a child of other parent, in this case, the desktop? Would it automatically remove itself from its parent?

Also, how can we get the desktop handle?

 

Fragger Fox

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 3 of 5
(5,337 Views)

Hi Fragger Fox,

from the description of the "SetParent" function, i think it will change the parent. You can get the desktop handle with the "GetDesktopWindow" function.

 

Mike

0 Kudos
Message 4 of 5
(5,333 Views)

You should be able to set a NULL handle to undo the parent-child relationship and make the child window again a normal top level window. Setting the desktop as parent is probably not the same as being a top level window.

Rolf Kalbermatter
My Blog
Message 5 of 5
(5,317 Views)