分享

会自动消失的对话框API函数--MessageBoxTimeout

 禁忌石 2017-04-20
会自动消失的对话框API函数--MessageBoxTimeout 
(2010-10-19 11:24:41)转载▼
标签: it 分类: 软件开发
//以下两个函数由user32.dll导出,只是没有微软官方文档记载,大家在cpp中包含了以下部分,就可以调用MessageBoxTimeout了。

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没有导出这个函数。
 
//举例如下:
    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);
    }

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多