Gold mine of Visual C++ tricks!
How to Set Dialog as TopMost Window?
![]()
I always wondered about popularity of Winamp. It has rich custom drawn UI, which made it stand out of the crowd. Did you noticed its “Always on top” feature and wondered about how its implemented? Its time to reveal the secret – How winamp implemented that feature – Staying at the top?

![]()
You can use – SetWindowPos() with HWND_TOPMOST flag. Have a look at the code snippet.
void CRabbitDlg::OnSetTopmost()
{
// Set window position to topmost window.
::SetWindowPos( GetSafeHwnd(),
HWND_TOPMOST,
0, 0, 0, 0,
SWP_NOMOVE | SWP_NOREDRAW | SWP_NOSIZE );
}
![]()
Single line of code. But wowing feature. isn’t it?
![]()
Targeted Audience – Beginners.
| Print article | This entry was posted by Jijo Raj on October 11, 2009 at 3:01 pm, and is filed under Visual C++, Windows APIs. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |









