Source file: /~heha/hs/hookany.zip/HOOKTEST.PAS

program hooktest;
uses WinProcs,WinTypes,Win31,CommDlg,WinCrt,Hook;

function myhook(var ofn: TOpenFileName):Bool; far;
 begin
  MessageBeep(0);
  myhook:=GetOpenFileName(ofn);
  MessageBeep(0);
  asm int 3 end;
 end;

function myhook2(var ofn: TOpenFileName):Bool; far;
 begin
  MessageBeep(0);
{  myhook2:=GetSaveFileName(ofn);}
  MessageBeep(0);
  asm int 3 end;
 end;
var
 W: HWnd;

begin
 WriteLn('Hallo!');
 SetHook(@GetOpenFileName,@MyHook,4,0,0,0);
 W:=FindWindow('KCEMU',nil);
 if w<>0 then begin
  w:=GetWindowTask(w);
  SetHook(@GetSaveFileName,@MyHook2,4,w,0,SH_NoResetHook);
 end;
end.
Detected encoding: ASCII (7 bit)2