• C

LockSetForegroundWindow - Keep the darn window visible no matter what

I have to keep a dialog box visible until I take action to remove it. I have a full screen window with a couple of other dialog boxes on top. One of the dialoga is a child of the full screen window and behaves pretty well. The other is NOT a child of the full screen and ends up getting lost in the Z order. I can, and do, send messages to the creating thread to redisplay the dialog when I do something to hide it but it's a pain. I have to think there is a way to force a window to stay on top no matter what.
I really thought that LockSetForegroundWindow would do it but it doesn't.
Same general topic - When I came upon LockSet....... in the documentation I tried it but the compile failed. Couldn't seem to find the function or the defines that go with it. They are in WinUser.h as:
#if(_WIN32_WINNT >= 0x0500)     // I had to manually #define this thing to get it to work.
WINUSERAPI                                // There has to be a better way!!!
    DWORD dwProcessId);

#define ASFW_ANY    ((DWORD)-1)

    UINT uLockCode);

#define LSFW_LOCK       1
#define LSFW_UNLOCK     2

#endif /* _WIN32_WINNT >= 0x0500 */
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>There has to be a better way!!!

The easiest way is to set the 'WS_EX_TOPMOST' style bit for that window.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BTW, see also http://support.microsoft.com/default.aspx?scid=kb;en-us;108315 ("How To Keep an MDI Window Always on Top") if we're talking MDI...
sandbarAuthor Commented:
Thank you jkr - I know it would be simple, but then everything is somple once you find it!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.