Library Lib1; Uses WinTypes, Messages, WinProcs, Toolhelp; Const WM_NOTIFY = WM_USER+$100; Var targetHWnd: HWnd; Function HookProc( wID: Word; dwData: LongInt ): Bool; export; BeginPostMessage( targetHWnd, WM_NOTIFY, wID, dwData );Result := FalseEnd; Procedure InstallHook( notifyWindow: HWnd ); export; BeginIf targetHWnd = 0 Then BeginIf not NotifyRegister( 0, HookProc, NF_NORMAL )Then BeginMessageBox( notifyWindow, 'Неудача NotifyRegister!','Ошибка!', MB_OK+MB_ICONSTOP );EndElse BegintargetHWnd:= notifyWindow;End;End;End; Procedure UnInstallHook; export; BeginIf targetHWnd <> 0 Then BeginNotifyUnregister( 0 );targetHWnd := 0;End;End; exports InstallHook,UnInstallHook; begin targetHWnd:= 0; end. |
[000504]