What is hook, and the hook is actually inserted into a function in the message chain to monitor the message. Of course this hook acts as a role of the message. For monitoring is that system messages cannot be encapsulated with an EXE file because the EXE process is opaque for other processes. Then what should I do, of course, I think of a DLL file, map the DLL to other process space, and don't solve it. Below the hook of a keyboard - filtering WM_KEYDOWN, WM_KEYUP button messages. Main program UseHook; uses Windows; var mStruct: TMsg; procedureHookOn; external 'pggpjjhook.dll'; procedure HookOff; external 'pggpjjkook.dll'; begin HookOn; // hook While GetMessage (mStruct, 0, 0 0) DO; // message loop Keyboard status hookh: dWord; // hook handle fileh: dWord; // file handle fsize: dword = 1; // To write the length WSIZE: DWORD; Recognition length fchar: array [0..1] of char; ((lParam shr 31) and 1) = 0) THEN / / Button Message Team Active Begin GetKeyboardState (KBS); // SHR 16) and $ 000000FF), KBS, @fchar [0], 0) = 1 Then # E, WSIZE, NIL); // Write key ASCII value # ; begin HookH: = SetWindowsHookEx (WH_KEYBOARD, KeyHookPro, hInstance, 0); end; // decoupling procedure hookOff; begin UnHookWindowsHookEx (HookH); end; exports HookOn, hookOff; begin end.