-
October 9th, 2008, 09:28 PM
#1
Message Box
I would like to create a message box that appear for a few seconds and closed by itself without the users interfering. How am I going about doing that?
Thanks in advance.
-
October 9th, 2008, 09:41 PM
#2
Re: Message Box
One way is to create your own dialog as a message box.
In OnInitdialog start a timer, initialize the timer.
handle OnTimer, which will be called when timer is over where dialog will destroy itself.
-
October 9th, 2008, 10:11 PM
#3
Re: Message Box
That is the most common approach and is quite effective. Just make sure you properly handle the possibility that the user may close the dialog BEFORE the timer expires!!!!!
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
October 9th, 2008, 10:22 PM
#4
Re: Message Box
or use a normal MessageBox and PostMessage the Enter Key
HWND hwnd= FindWindow(messagebox_classname_IDK, NULL);
PostMessage(hwnd, WM_KEYDOWN, VK_ENTER, 0);
use Winspector Spy or Micrsoft Spy++
make the messagebox trigger then look at the messages to find the classname
Last edited by sspoke; October 9th, 2008 at 10:27 PM.
-
October 10th, 2008, 12:27 AM
#5
Re: Message Box
Why don't you use the well-known MS sample ?!
This has been answered thousands of times for 18 years on google groups...
-
October 10th, 2008, 07:54 AM
#6
Re: Message Box
Originally Posted by sspoke
or use a normal MessageBox and PostMessage the Enter Key
HWND hwnd= FindWindow(messagebox_classname_IDK, NULL);
PostMessage(hwnd, WM_KEYDOWN, VK_ENTER, 0);
use Winspector Spy or Micrsoft Spy++
make the messagebox trigger then look at the messages to find the classname
1) Please use code tags!!!!!
2) You STILL need a timer to execute this code.
3) the race condition I mentioned earlier may occur.
4) It is a more complicated solution that neccessary.
5) It is more tightly bound to the platform API's than necessary.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
October 10th, 2008, 08:07 AM
#7
Re: Message Box
Originally Posted by sspoke
or use a normal MessageBox and PostMessage the Enter Key
HWND hwnd= FindWindow(messagebox_classname_IDK, NULL);
PostMessage(hwnd, WM_KEYDOWN, VK_ENTER, 0);
use Winspector Spy or Micrsoft Spy++
make the messagebox trigger then look at the messages to find the classname
How does that keep the message box open for a certain period of time?
-
October 10th, 2008, 08:09 AM
#8
Re: Message Box
Just to continue fred100's post: How to create a timed message box
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|