-------------------------------------------------------------------------------------------
|未公开的提示框能实现自动消息|
-------------------------------------------------------------------------------------------
extern "C"
{
int WINAPI MessageBoxTimeoutA(IN HWND hWnd, IN LPCSTR lpText, IN LPCSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD
dwMilliseconds);
int WINAPI 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
需要指出的是,Windows 2000的user32.dll没有导出这个函数。//要用MessageBoxTimeoutA这个函数,一定要在CPP实现头中声明
使用实例
//举例如下:
int ret = MessageBoxTimeoutA(NULL, "倒计时?", "tishi", MB_OKCANCEL, 0, 10*1000);//句柄 提示的信息 标题 风格 未知 毫秒
if( IDOK == ret)
{
::MessageBox(NULL, "IDOK", "结果", MB_OK);
}
else if( IDCANCEL == ret)
{
::MessageBox(NULL, "IDCANCEL", "结果", MB_OK);
}
else if( IDTIMEOUT == ret)
{
::MessageBox(NULL, "IDTIMEOUT", "结果", MB_OK);
}
-------------------------------------------------------------------------------------------
|未公开的提示框能实现自动消息|
-------------------------------------------------------------------------------------------
extern "C"
{
int WINAPI MessageBoxTimeoutA(IN HWND hWnd, IN LPCSTR lpText, IN LPCSTR lpCaption, IN UINT uType, IN WORD wLanguageId, IN DWORD
dwMilliseconds);
int WINAPI 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
需要指出的是,Windows 2000的user32.dll没有导出这个函数。//要用MessageBoxTimeoutA这个函数,一定要在CPP实现头中声明
使用实例
//举例如下:
int ret = MessageBoxTimeoutA(NULL, "倒计时?", "tishi", MB_OKCANCEL, 0, 10*1000);//句柄 提示的信息 标题 风格 未知 毫秒
if( IDOK == ret)
{
::MessageBox(NULL, "IDOK", "结果", MB_OK);
}
else if( IDCANCEL == ret)
{
::MessageBox(NULL, "IDCANCEL", "结果", MB_OK);
}
else if( IDTIMEOUT == ret)
{
::MessageBox(NULL, "IDTIMEOUT", "结果", MB_OK);
}
-------------------------------------------------------------------------------------------