會(huì)自動(dòng)消失的對(duì)話(huà)框API函數(shù)--MessageBoxTimeout (2010-10-19 11:24:41)轉(zhuǎn)載▼ 標(biāo)簽: it 分類(lèi): 軟件開(kāi)發(fā) //以下兩個(gè)函數(shù)由user32.dll導(dǎo)出,只是沒(méi)有微軟官方文檔記載,大家在cpp中包含了以下部分,就可以調(diào)用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沒(méi)有導(dǎo)出這個(gè)函數(shù)。 //舉例如下: int ret = MessageBoxTimeoutA(NULL, "倒計(jì)時(shí)?", "tishi", MB_OKCANCEL, 0, 10*1000); if( IDOK == ret) { ::MessageBox(NULL, "IDOK", "結(jié)果", MB_OK); } else if( IDCANCEL == ret) { ::MessageBox(NULL, "IDCANCEL", "結(jié)果", MB_OK); } else if( IDTIMEOUT == ret) { ::MessageBox(NULL, "IDTIMEOUT", "結(jié)果", MB_OK); }
|
|