Click here to Skip to main content
15,890,043 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello, I've been googling for days for how to set window's owner without activating/bringing owner to front and couldn't manage to find it. Currently I'm using winapi:
SetWindowLong(hwndWindow, GWL_HWNDPARENT, hwndOwner); // GWL_HWNDPARENT = -8

or built in wrap:
new WindowInteropHelper(window) { Owner = owner };

Both works fine for setting owner, but they are bringing owner window to front which causes problems when there are a lot of windows.

Thanks for help!
Posted

1 solution

Please see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms633541%28v=vs.85%29.aspx[^].

Pay attention for the note in "Remarks" about the requirement to change the styles and synchronize the UISTATE.

—SA
 
Share this answer
 
Comments
chainerlt 6-Mar-15 0:24am    
Thanks, I managed to get this working by manually setting window styles before setting owner.
Sergey Alexandrovich Kryukov 6-Mar-15 0:43am    
Great. You are very welcome.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900