int MessageBox( HWND hWnd, // handle to owner window LPCTSTR lpText, // text in message box LPCTSTR lpCaption, // message box title UINT uType // message box style );
int MessageBoxIndirect(
CONST LPMSGBOXPARAMS lpMsgBoxParams // message box parameters
);
typedef struct {
UINT cbSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCTSTR lpszText;
LPCTSTR lpszCaption;
DWORD dwStyle;
LPCTSTR lpszIcon;
DWORD_PTR dwContextHelpId;
MSGBOXCALLBACK lpfnMsgBoxCallback;
DWORD dwLanguageId;
} MSGBOXPARAMS, *PMSGBOXPARAMS;
HHOOK hMsgBoxHook = SetWindowsHookEx( WH_CBT, // Type of hook CBTProc, // Hook procedure (see below) NULL, // Module handle. Must be NULL (see docs) GetCurrentThreadId() // Only install for THIS thread!!! );
LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)
{
HWND hwnd;
if(nCode < 0)
return CallNextHookEx(hMsgBoxHook, nCode, wParam, lParam);
switch(nCode)
{
case HCBT_ACTIVATE:
// 现在wParam中就是message box的句柄
hwnd = (HWND)wParam;
// 我们已经有了message box的句柄,在这里我们就可以定制message box了!
return 0;
}
// Call the next hook, if there is one
return CallNextHookEx(hMsgBoxHook, nCode, wParam, lParam);
}
int MsgBoxEx(HWND hwnd, TCHAR *szText, TCHAR *szCaption, UINT uType)
{
int ret;
// Install a thread hook, so we can customize it
hMsgBoxHook = SetWindowsHookEx(
WH_CBT,
CBTProc,
NULL,
GetCurrentThreadId()
);
// Display a standard message box
ret = MessageBox(hwnd, szText, szCaption, uType);
// remove the window hook
UnhookWindowsHookEx(hMsgBoxHook);
return ret;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有