Force child window into foreground: GetWindowPlacement

Started by jj2007, January 20, 2010, 03:30:16 PM

Previous topic - Next topic

jj2007

I had a problem with overlapping child windows, a listbox that should remain visible above a richedit control.

After trying the known suspects, GetWindowPlacement turned out to be the most elegant solution. Maybe it's helpful for somebody else.

if 1
lea ebx, wpf ; saves 6 bytes compared to 3*addr wpf
mov esi, hList ; saves 9 bytes compared to 3*hList
mov wpf.iLength, sizeof wpf ; windows.inc version; MSDN name is length
invoke GetWindowPlacement, esi, ebx
mov wpf.showCmd, SW_SHOWMINNOACTIVE
invoke SetWindowPlacement, esi, ebx
mov wpf.showCmd, SW_SHOWNOACTIVATE
invoke SetWindowPlacement, esi, ebx
else
invoke ShowWindow, hList, SW_SHOWMINNOACTIVE ; shorter but shows disturbing
invoke ShowWindow, hList, SW_SHOWNOACTIVATE ; min to restore animation
endif