Getting the handle of the top most window
How can I get the topmost window handle.
i have set the window position as follows:
pWnd->SetWindowPos(&wndTopMost , 0,0, 0, 0, SWP_NOSIZE);
I need to check if pWnd is topmost many times in the program. If it is not on top, I will set the window position as above.
How can I check that?
Thanks in advance.
Re: Getting the handle of the top most window
A topmost window has WS_EX_TOPMOST extended style set.
Code:
DWORD dwExStyle = pWnd->GetExStyle();
if(WS_EX_TOPMOST & dwExStyle)
{
// topmost window
// ...
}
Note: you may want to add SWP_NOMOVE flag in SetWindowPos, as well.
Re: Getting the handle of the top most window
Quote:
Originally Posted by
zuhrs
I need to check if pWnd is topmost many times in the program. If it is not on top, I will set the window position as above.
Don't do it! It is VERY annoying!