How to make a Dialog based program always on Top?

Started by
7 comments, last by Dave Hunt 18 years, 7 months ago
Hello, could you please let me know : how to make a Dialog based program always on Top? Thanks a lot in advance.
Advertisement
Are you using windows? If so, are you using MFC, or the .NET framework, or straight-up Win32 SDK?

For .NET, the form has a TopMost property you can set to True. For Win32 (or MFC) you can call SetWindowstyle, passing in the HWND for your window and WS_EX_TOPMOST for the style.



~BenDilts( void );
Hi BeanDog,
Thank you so much for your quick reply!
I will try.
Have a nice day!
HI BeanDog, sorry to bother you.

I tried, but it doesn't work:

// ModifystyleEx(0, WS_EX_TOPMOST);
HWND hWnd = GetSafeHwnd ();
SetWindowLong(m_hWnd, GWL_EXstyle, WS_EX_TOPMOST);

if it is possible to let me know why?
To set the topmost property, you have to use SetWindowPos.
Thank you Dave Hunt!

But the SetWindowPos doesn't work either:

::SetWindowPos(m_hWnd, HWND_TOPMOST,
0, 0, 800, 605, SWP_NOZORDER);

That's because you specified SWP_NOZORDER. That parameter told the function to ignore your HWND_TOPMOST.
Thank you so much Dave Hunt!
it is correct. I should read the parameters carefully.
Have a good day!
You're welcome!

This topic is closed to new replies.

Advertisement