Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Displaying a MessageBox 'On Top'

Posted on 2002-05-09
5
Medium Priority
?
945 Views
Last Modified: 2008-03-06
I am using Borland C++ Builder 4.0

Could someone please show me a code example that will make a MessageBox display on top of all other applications that may be running?

(ie.  My program will be running in the background while an on-line game runs in the foreground in Windows, though it does not directly interact with the game.  I want to give the user an option in the menu to have a messagebox appear on top of running applications when a timer runs out.  So far all I can get is the messagebox to appear behind other applications, though in front of my program.)

Thanks.
0
Comment
Question by:LordDamein
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6999563
MessageBox ( GetForegroundWindow(), "On Top", "Title", MB_OK | MB_ICONINFORMATION);

should do it - if not, add MB_SYSTEMMODAL to the flags, though I would not recommend using that too often...
0
 
LVL 4

Accepted Solution

by:
pagladasu earned 400 total points
ID: 6999597
Try:
 MessageBoxEx(NULL,"Hello","Message",MB_OK|MB_TOPMOST, NULL);

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7000124
If you are talking about an online game such as QUAKE Deathmatch or HALFLIFE, you need to realize that they use DirectX.  In fullscreen mode, you will not be able to popup a messagebox in front of such screens.

-- Dan
0
 

Author Comment

by:LordDamein
ID: 7000231
The game is Ultima Online.  Popups will work fine with it.  Actually, my program works as is, but I would like to add the 'on top' option.  I am testing out the MB_TOPMOST right now and it works sort of.  (I already tried the MB_SYSTEMMODAL and that didn't.  Also, the GetForegroundWindow() brings up errors.  :(
0
 

Author Comment

by:LordDamein
ID: 7018513
The MB_TOPMOST seems to be the only thing that works for me and does what I need.  I tried all of the other suggestions without success.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question