mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-21 17:09:06 -07:00
user32/msgbox: Use a windows hook to trap Ctrl+C
This commit is contained in:
parent
375ff622d1
commit
083102cd83
1 changed files with 21 additions and 0 deletions
|
@ -394,6 +394,22 @@ static void MSGBOX_CopyToClipbaord( HWND hwnd )
|
|||
free(text);
|
||||
}
|
||||
|
||||
HHOOK msghook_handle;
|
||||
|
||||
LRESULT CALLBACK msg_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
MSG *msg = (MSG *)lParam;
|
||||
if (nCode == MSGF_DIALOGBOX && msg->message == WM_KEYUP)
|
||||
{
|
||||
if ( (msg->wParam == 'C' || msg->wParam == 'c') && (NtUserGetKeyState(VK_CONTROL) & 0x8000))
|
||||
{
|
||||
MSGBOX_CopyToClipbaord(GetParent(msg->hwnd));
|
||||
}
|
||||
}
|
||||
|
||||
return NtUserCallNextHookEx(msghook_handle, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* MSGBOX_DlgProc
|
||||
*
|
||||
|
@ -409,6 +425,7 @@ static INT_PTR CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message,
|
|||
SetWindowContextHelpId(hwnd, mbp->dwContextHelpId);
|
||||
MSGBOX_OnInit(hwnd, mbp);
|
||||
SetPropA(hwnd, "WINE_MSGBOX_HELPCALLBACK", mbp->lpfnMsgBoxCallback);
|
||||
msghook_handle = SetWindowsHookExA(WH_MSGFILTER, msg_hook_proc, NULL, GetCurrentThreadId());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -416,6 +433,10 @@ static INT_PTR CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message,
|
|||
MSGBOX_CopyToClipbaord(hwnd);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
NtUserUnhookWindowsHookEx(msghook_handle);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue