tags:

views:

288

answers:

1

BringWindowToTop, SetForegroundWindow, SwitchToThisWindow, SetWindowPos, ShowWindow all are described as showing and activating a window.

What are the real differences between them? When and why would BringWindowToTop be preferred to SetForegroundWindow, (Or SwitchToThisWindow or even SetWindowPos with the flags to activate and show)?

+1  A: 

use setwindowpos if you need to change the size of the window (not just its state) use showwindow to change just the state of the window use bringwindowtotop to activate a parent window via the child. if you send it a child window (perhaps a floating toolbar) the parent will be brought to front and have focus instead of the child.

they all have their place and obviously have duplicate functionality, but each does things just a little different depending on what you want to do.

best regards, don

Don Dickinson