C/C++/C# Force window to be on top

user197967 picture user197967 · Dec 9, 2009 · Viewed 11k times · Source

Is the there a way to force another window to be on top? Not the application's window, but another one, already running on the system. (Windows, C/C++/C#)

Answer

Jerry Coffin picture Jerry Coffin · Dec 9, 2009
SetWindowPos(that_window_handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

BringWindowToTop moves the window to the top of the Z-order (for now) but does not make it a topmost window.