VC创建定时关闭的MessageBox

VC创建定时关闭的MessageBox,第1张

1、第一种方法:用微软提供的官方文档

From : http://support.microsoft.com/kb/181934/en-us/

Generally, when you want to display a message box for a limited amount of time, you must implement a regular dialog box that closes itself after a specified amount of time. The problem with this method is that you lose the standard message box functionality that Windows provides.

The following example shows how to use the MessageBox function to create a message box that automatically closes after a specified amount of time. Note the following about the example:

  • The example uses a Windows timer that fires an event after the specified amount of time has elapsed.
  • When the timer event occurs, the PostQuitMessage API is used to break out of the modal message loop that MessageBox uses.
  • Note The WM_QUIT message must be removed from the message queue to prevent it from being retrieved in the main message queue.

[cpp] view plaincopyprint?

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/2086610.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-07-22
下一篇 2022-07-22

发表评论

登录后才能评论

评论列表(0条)

保存