怎么将MessageBox弹出的对话框放置在最前面
1个回答
展开全部
#include
HHOOK hHook;
LRESULT __stdcall CBTHookProc( long nCode,WPARAM wParam,LPARAM lParam);
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,LPSTR szCmdLine, int iCmdShow)
{
hHook=SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,hInst,NULL);
if (hHook)
{
MessageBox(NULL,"帅哥?","SC++",MB_ICONINFORMATION|MB_YESNO);
}
else
{
MessageBox(NULL,"安装HOOK" ,"SC++",MB_ICONINFORMATION|MB_YESNO);
}//if
return 1;
}
LRESULT __stdcall CBTHookProc( long nCode,WPARAM wParam,LPARAM lParam)
{
if (nCode==HCBT_ACTIVATE)
{
SetDlgItemText((HWND)wParam,IDYES,"&Yes");
SetDlgItemText((HWND)wParam,IDNO ,"&No");
UnhookWindowsHookEx(hHook);
}
return 0;
}
段代码 才能用MFC 工程呢
HHOOK hHook;
LRESULT __stdcall CBTHookProc( long nCode,WPARAM wParam,LPARAM lParam);
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,LPSTR szCmdLine, int iCmdShow)
{
hHook=SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,hInst,NULL);
if (hHook)
{
MessageBox(NULL,"帅哥?","SC++",MB_ICONINFORMATION|MB_YESNO);
}
else
{
MessageBox(NULL,"安装HOOK" ,"SC++",MB_ICONINFORMATION|MB_YESNO);
}//if
return 1;
}
LRESULT __stdcall CBTHookProc( long nCode,WPARAM wParam,LPARAM lParam)
{
if (nCode==HCBT_ACTIVATE)
{
SetDlgItemText((HWND)wParam,IDYES,"&Yes");
SetDlgItemText((HWND)wParam,IDNO ,"&No");
UnhookWindowsHookEx(hHook);
}
return 0;
}
段代码 才能用MFC 工程呢
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询