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.
Printable View
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.
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.
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!!!!!
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
Why don't you use the well-known MS sample ?!
This has been answered thousands of times for 18 years on google groups...
1) Please use code tags!!!!!Quote:
Originally Posted by sspoke
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.
How does that keep the message box open for a certain period of time?Quote:
Originally Posted by sspoke
Just to continue fred100's post: How to create a timed message box