-
December 6th, 2004, 08:42 AM
#1
Simple way to make a timeout message box
Is there a simple way to display a message box that just kills itself after a certain amount of time (not using MFC)? It would also be nice if the message box were modeless.
THe only reason I am doing this is that windows demands a 2-second wait for the serial port handle to be released (on some machines it happens faster than that, but 2 seconds is in the docs so to be safe one better do the wait). 2 seconds is a long enouhg time to be irritating so I'd like to inform the user without the user having to do anything.
Probably have to create a modeless dialog box or class window with a static window containing the message with a self destructing timer, right?
Brian
-
December 6th, 2004, 09:23 AM
#2
Re: Simple way to make a timeout message box
You may use SetTimer to create a timer with an elapse of 1000 milliseconds. You can specify that your modeless dialog will receive WM_TIMER if the second elapses. Then you may count the seconds, and close the dialog after 30 seconds elapse.
But you have to design this messagebox on your own, because I do not think that you can display the windows messagebox modeless.
-
December 6th, 2004, 09:47 AM
#3
Re: Simple way to make a timeout message box
That's what I was afraid of. Have to make my own window, callback, timer, and in the callback a handler for the timer to destroy the window. I have an owner draw message box which I guess I might as well modify to handle this type of thing. No easy way out!
Brian
-
December 6th, 2004, 09:53 AM
#4
Re: Simple way to make a timeout message box
Last edited by NoHero; December 6th, 2004 at 09:56 AM.
-
December 6th, 2004, 11:51 AM
#5
Re: Simple way to make a timeout message box
Thanks NoHero,
I'll take a look at their approach....but I think I will ditch the thread.
Brian
-
December 6th, 2004, 12:02 PM
#6
Re: Simple way to make a timeout message box
-
February 25th, 2025, 01:51 PM
#7
Re: Simple way to make a timeout message box
 Originally Posted by NoHero
found a work around?
This is like 21 years later, but I finally came across another person's API solution - works like a dream:
https://stackoverflow.com/questions/...another-thread
-
February 25th, 2025, 01:56 PM
#8
Re: Simple way to make a timeout message box
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
|