You are here:

C++/"Modal" Windows?

Advertisement


Question
I'm very much a beginner, so I appreciate any help I can.  :)  I would like to create a MSN messenger-type notification window, such as the box that will open saying, "You have a new message from Bob" in the lower right corner.  I think I have everything I need done, the window will display Ok and as I want it, but if you click on another window my window will disappear before it's ready.

How can I keep the window on top without stealing the focus?

Thanks, I really appreciate it.

Answer
AJ, Thank you for your question.

Unfortunately, you did not state your Operating System, which might be Linux, Sun OS, Windows 3.x, Windows 9x/ME, Windows NT/2000, Windows XP, Windows Longhorn, MSDOS, MacOS, etc.

If you are using Windows, and not using MFC, you can make a window be "topmost" using code like this:

SetWindowPos(HandleOfWindow, HWND_TOPMOST, 0, 0,
     0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);

David Spector

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


David Spector

Expertise

Highly knowledgeable in the C++ language, Visual C++ (MSVC), Windows API, documentation and other quality-assurance techniques, and debugging. Knowledgeable in MFC, COM, GUI design, and object-oriented design.

Experience

I have been a software engineer since 1965. I have been published. My specializations have been: biomedical programming, compiler implementation, and many kinds of Windows programming. I don't do Databases or other business-oriented stuff.

Publications
Windows?/DOS Developer's Journal, ACM SIGPLAN Notices, and Computer Science Press.

Education/Credentials
ICCP Systems Programming Certification
Master's degree equivalent in Computer Science

©2016 About.com. All rights reserved.