about grobal message hook (WH_CALLWNDPROC) (illegal operation)
From: Qzg=FCr=20TU=D0RUL?= (oztugrul_at_hacettepe.edu.tr)
Date: 12/31/03
- Next message: Thomas Mueller: "Re: Make a program unkillalbe"
- Previous message: Marcio Ehrlich: "Re: Selecting a folder"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 31 Dec 2003 15:14:13 +0200
hi everybody,
i want to capture all windows messages so i wrote a message hook program
to run my function in my dll ... the problem is when i click the button
windows says "illegal operation" for every programs in windows ...
actually, i guess i know the reason ... in my function (it's in my dll),
i'm tryin' to write all messages to a textfile ... i think this causes
that errors (illegal operation) ... anyway here is my codes ... please
tell me how can i catch all windows' messages ? (like WinSight)
the function in my dll :
function GlobalMessageHook(code: integer; wParam: word; lParam:
longword): longword; stdcall;
begin
if code<0 then begin
GlobalMessageHook:=CallNextHookEx(CurrentHook,code,wParam,lparam);
Exit;
end;
with PMsg(lParam)^ do begin
assignfile(CurFile,'log.txt');
if fileexists('log.txt')=false then rewrite(CurFile) else
reset(CurFile);
writeLn(CurFile, message, hwnd, lparam, wparam);
closefile(CurFile);
end;
CallNextHookEx(CurrentHook,code,wParam,lparam);
GlobalMessageHook:=0;
Exit;
end;
============================================
Özgür TUĞRUL
Application & System Programmer
Ass. Database & System Adm.
Statistician & Research Ass.
Hacettepe University Office of the Registrar
Data Processing Department - System Room
oztugrul@hacettepe.edu.tr
http://yunus.hacettepe.edu.tr/~oztugrul/
============================================
- Next message: Thomas Mueller: "Re: Make a program unkillalbe"
- Previous message: Marcio Ehrlich: "Re: Selecting a folder"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]