The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: jj2007 on January 20, 2010, 03:30:16 PM

Title: Force child window into foreground: GetWindowPlacement
Post by: jj2007 on January 20, 2010, 03:30:16 PM
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