http://www.blogjava.net/baicker/archive/2007/07/13/130072.html
 #include <windows.h>
#include <tchar.h> //Functions & other definitions required-->
typedef int (__stdcall *MSGBOXAAPI)(IN HWND hWnd,
IN LPCSTR lpText, IN LPCSTR lpCaption,
IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds);
typedef int (__stdcall *MSGBOXWAPI)(IN HWND hWnd,
IN LPCWSTR lpText, IN LPCWSTR lpCaption,
IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds); int MessageBoxTimeoutA(IN HWND hWnd, IN LPCSTR lpText,
IN LPCSTR lpCaption, IN UINT uType,
IN WORD wLanguageId, IN DWORD dwMilliseconds);
int MessageBoxTimeoutW(IN HWND hWnd, IN LPCWSTR lpText,
IN LPCWSTR lpCaption, IN UINT uType,
IN WORD wLanguageId, IN DWORD dwMilliseconds); #ifdef UNICODE
#define MessageBoxTimeout MessageBoxTimeoutW
#else
#define MessageBoxTimeout MessageBoxTimeoutA
#endif #define MB_TIMEDOUT 32000 int MessageBoxTimeoutA(HWND hWnd, LPCSTR lpText,
LPCSTR lpCaption, UINT uType, WORD wLanguageId,
DWORD dwMilliseconds)
{
static MSGBOXAAPI MsgBoxTOA = NULL; if (!MsgBoxTOA)
{
HMODULE hUser32 = GetModuleHandle(_T("user32.dll"));
if (hUser32)
{
MsgBoxTOA = (MSGBOXAAPI)GetProcAddress(hUser32,
"MessageBoxTimeoutA");
//fall through to 'if (MsgBoxTOA)...'
}
else
{
//stuff happened, add code to handle it here
//(possibly just call MessageBox())
return ;
}
} if (MsgBoxTOA)
{
return MsgBoxTOA(hWnd, lpText, lpCaption,
uType, wLanguageId, dwMilliseconds);
} return ;
} int MessageBoxTimeoutW(HWND hWnd, LPCWSTR lpText,
LPCWSTR lpCaption, UINT uType, WORD wLanguageId, DWORD dwMilliseconds)
{
static MSGBOXWAPI MsgBoxTOW = NULL; if (!MsgBoxTOW)
{
HMODULE hUser32 = GetModuleHandle(_T("user32.dll"));
if (hUser32)
{
MsgBoxTOW = (MSGBOXWAPI)GetProcAddress(hUser32,
"MessageBoxTimeoutW");
//fall through to 'if (MsgBoxTOW)...'
}
else
{
//stuff happened, add code to handle it here
//(possibly just call MessageBox())
return ;
}
} if (MsgBoxTOW)
{
return MsgBoxTOW(hWnd, lpText, lpCaption,
uType, wLanguageId, dwMilliseconds);
} return ;
}
//End required definitions <--
//Call the function as follows: // Collapse
//you must load user32.dll before calling the function
main()
{
HMODULE hUser32 = LoadLibrary(_T("user32.dll")); if (hUser32)
{
int iRet = ;
UINT uiFlags = MB_OK|MB_SETFOREGROUND|MB_SYSTEMMODAL|MB_ICONINFORMATION; iRet = MessageBoxTimeout(NULL, _T("Test a timeout of 2 seconds."),
_T("MessageBoxTimeout Test"), uiFlags, , );
//iRet will = 1 uiFlags = MB_YESNO|MB_SETFOREGROUND|MB_SYSTEMMODAL|MB_ICONINFORMATION; iRet = MessageBoxTimeout(NULL, _T("Test a timeout of 5 seconds."),
_T("MessageBoxTimeout Test"), uiFlags, , );
//iRet will = MB_TIMEDOUT if no buttons pressed, button values otherwise //only unload user32.dll when you have no further need
//for the MessageBoxTimeout function
FreeLibrary(hUser32);
}
}
 

未公开函数MessageBoxTimeOut 实现定时消息(ZT) MFC实现MessageBox自动消失的更多相关文章

  1. Jquery 网站保存信息提示消息实现,提示后自动消失

    现在的大多数网站都有校验,以及信息提示:为了给用户更好的体验可以不用alert提示消息,采用jQuery提示完消息,自动消失 css <style> #tip_message { z-in ...

  2. PowerBuilder -- 未公开函数

    原文:http://blog.csdn.net/happymagic/article/details/51077322 @.已知一个DW中的某列的列名(在字符串变量中),以获得这个列对象的DWO 方法 ...

  3. 未公开函数 NtQuerySystemInfoMation 遍历进程信息,获得进程的用户名(如: system,Admin..)

    目录 遍历进程用户名 代码例子 遍历进程用户名 代码例子 #include <windows.h> #include <iostream> #include <COMDE ...

  4. CListCtrlEx:一个支持文件拖放和实时监视的列表控件——用未公开API函数实现Shell实时监视

    一.需求无论何时,当你在Explorer窗口中创建.删除或重命名一个文件夹/文件,或者插入拔除移动存储器时,Windows总是能非常快速地更新它所有的视图.有时候我们的程序中也需要这样的功能,以便当用 ...

  5. (转载)MS SQL Server 未公开的加密函数有哪些?

    MS SQL Server 未公开的加密函数有哪些? 以下的文章是对MS SQL Server 未公开的加密函数的具体操作,如果你对其相关的实际操作有兴趣的话,你就可以点击了. MS SQL Serv ...

  6. PB Event ID 含义 内容浅析2 未公开的数据窗口事件

    原网址:https://www.cnblogs.com/lenya/archive/2010/11/12/3706971.html  (作者:Mark   Brown)         到目前为止,P ...

  7. 微软未公开的 SP

    一些用在SQL 2000的企业管理GUI中,并且不打算用于其他的流程.微软已预计将其中的一些存储过程从未来的SQL Server版本中删除(或已经删除了).虽然这些存储过程可能很有用并为你节省了很多时 ...

  8. 利用未公开API获取终端会话闲置时间(Idle Time)和登入时间(Logon Time)

    利用未公开API获取终端会话闲置时间(Idle Time)和登入时间(Logon Time)作者:Tuuzed(土仔)   发表于:2008年3月3日23:12:38 版权声明:可以任意转载,转载时请 ...

  9. Go语言公开或未公开的标识符

    Go语言公开或未公开的标识符的基本概念 Go语言支持从包里公开或者隐藏标志符,通过这个特性,可以让用户按照自己的规则控制标识符的可见性. Go语言中的可见性,是通过声明类型的大小写来进行区别的. 例如 ...

随机推荐

  1. upper_bound——自己的实现

    int BSearch() { int ln(1),rn(n+1); while(ln+1<rn) { int mid=(ln+rn)>>1; if (Check(mid)) { l ...

  2. SharePreferences使用

    获取数据: @SuppressLint("InlinedApi") private String getFromSharePreference(String key) { if ( ...

  3. win10 sublime license

    —– BEGIN LICENSE —– TwitterInc 200 User License EA7E-890007 1D77F72E 390CDD93 4DCBA022 FAF60790 61AA ...

  4. 基于HTML5的PACS--HTML5图像处理

    在此之前,此系统是结合DICOM的WADO标准,在浏览器里通过javascript操作返回的JPG图片.这种服务器端解析,客户端展现的方式,对实现图像的移动.缩放.旋转.测量等图像操作能够实现实时的交 ...

  5. Android GC 原理探究

    导语 想写一篇关于 android GC 的想法来源于追查一个魅族手机图片滑动卡顿问题,由于不断的 GC 导致的丢帧卡顿的问题让我们想了很多方案去解决,所以就打算详细的看看内存分配和 GC 的原理,为 ...

  6. php 源码编译

    https://cyberpersons.com/2016/08/28/install-nginx-php-php-fpm-mysql-source-run-wordpress-site-ubuntu ...

  7. php-fpm.conf配置说明(重点要改动和优化的地方)

    <?xml version="1.0" ?> <configuration> All relative paths in this config are r ...

  8. 文本聚类——Kmeans

    上两篇文章分别用朴素贝叶斯算法和KNN算法对newgroup文本进行了分类測试.本文使用Kmeans算法对文本进行聚类. 1.文本预处理 文本预处理在前面两本文章中已经介绍,此处(略). 2.文本向量 ...

  9. servelet

    获取页面传递过来的参数. 调用后台代码实现相关业务逻辑. 根据返回结果,进行页面跳转.   问题:httpsession? 拆解: String 里面的.spllit方法.拆开后,返回值为string ...

  10. 【LeetCode】Word Break 解题报告

    Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separa ...