home *** CD-ROM | disk | FTP | other *** search
- { This is a simple DLL import unit to give us access to the functions in }
- { the HOOKDLL.PAS file. This is the unit your project will use. }
- unit Hookunit;
-
- interface
-
- uses WinTypes;
-
- function InstallSystemHook: boolean;
- function InstallTaskHook: boolean;
- function RemoveHook: boolean;
- function IsHookSet: boolean;
- { Do not use InstallHook directly. Use InstallSystemHook or InstallTaskHook. }
- function InstallHook(SystemHook: boolean; TaskHandle: THandle): boolean;
-
- implementation
-
- uses WinProcs;
-
- const
- HOOK_DLL = 'HOOKDLL.DLL';
-
- function InstallHook(SystemHook: boolean; TaskHandle: THandle): boolean; external HOOK_DLL;
- function RemoveHook: boolean; external HOOK_DLL;
- function IsHookSet: boolean; external HOOK_DLL;
-
- function InstallSystemHook: boolean;
- begin
- InstallHook(TRUE, 0);
- end;
-
- function InstallTaskHook: boolean;
- begin
- InstallHook(FALSE,
- {$IFDEF WIN32}
- GetCurrentThreadID
- {$ELSE}
- GetCurrentTask
- {$ENDIF}
- );
- end;
-
- end.
-
-