, :
, CTRL + BREAK . CTRL + C , , . , : CTRL + ESC CTRL + ALT + DEL. ( ), WM_CANCELJOURNAL
.
, WM_CANCELJOURNAL
, SetWindowsHookEx
. WM_*
(WndProc
WinForms), - .
, , WH_GETMESSAGE
hook:
. GetMessage, .
[., ]
WM_CANCELJOURNAL
NULL
, . WM_CANCELJOURNAL
: , GetMessage
PeekMessage
DispatchMessage
. , hook GetMsgProc
( SetWindowsHookEx
WH_GETMESSAGE
), .
WinForms , , . , : . , , , , , , , WH_GETMESSAGE
, , WM_CANCELJOURNAL
.
Update:
GetMessageProc
code
, hook . 0, HC_ACTION
. code
0, hook CallNextHookEx
. , JournalRecordProc
.
MSG
, lParam
. Win32. .NET, P/Invoke . MSG
System.Windows.Forms.Message
( , WndProc
), , GetMessageProc
: :
public delegate int GetMessageProc(int code, IntPtr wParam, ref Message lParam);
Windows MSG
member Message
. , WM_CANCELJOURNAL
:
public static int GetMessageProc(int code, IntPtr wParam, ref Message lParam)
{
if (code >= 0)
{
if (lParam.Msg == WM_CANCELJOURNAL)
{
}
}
return CallNextHookEx(messageHook, code, wParam, ref lParam);
}
, , CallNextHookEx
, CallNextHookEx
, GetMessageProc
:
[DllImport("user32.dll")]
public static extern int CallNextHookEx(IntPtr hHook, int nCode,
IntPtr wParam, ref Message lParam);