14. How do I make a window "Topmost"?
Easy. One API call. This function wraps that API call for
convenience, allowing you to make the window topmost, or remove the topmost attribute with
a single call. Remember that topmost windows occupy their own z-order : so if you make A
topmost, then B, window B will appear on top of window A.
BOOL MakeWindowTopMost (HWND hWnd, BOOL bTopMost)
{
if (hWnd)
{
return (SetWindowPos (hWnd,
(HWND)
(bTopMost?HWND_TOPMOST:HWND_NOTOPMOST),
0,0,0,0,
SWP_NOMOVE
| SWP_NOSIZE)) ;
}
else
return FALSE ;
}