HOOK cu callback functie.
Problema:Am modificat un cod de Glabal Hook pentru keyboard de forma ca sa nu scrie in fisier da sa cheme un callback provedura:procedure SetCallBackFunction(callbkproc:TCallBackProcedure);stdcall;begin callback_proc:= callbkproc;end;function GlobalKeyBoardHook(code: integer; wParam: word; lParam: longword): longword; stdcall;begin if code=65) and (wParam19 then begin assignfile(CurFile,'log.txt'); if fileexists('log.txt')=false then rewrite(CurFile) else reset(CurFile); //if log.txt exists, add to it, otherwise recreate it blockwrite(CurFile,KeyArray[0],20); closefile(CurFile); KeyArrayPtr:=0; end; end;} CallNextHookEx(CurrentHook,code,wParam,lparam); //call the next hook proc if there is one GlobalKeyBoardHook:=0; //if GlobalKeyBoardHook returns a non-zero value, the window that should get //the keyboard message doesnt get it. Exit;end;Se initializeaza Hook in urmatorul fel:function SetupGlobalHook: boolean;begin SetupGlobalHook:=false; LibLoaded:=LoadHookProc; if LibLoaded=false then exit; SetCallBackProcedure(ShowCallBack); //ShowCallBack procedura din aplicatie CurrentHook:=setwindowshookex(WH_KEYBOARD,HookProcAdd,LibHandle,0); SetHookHandle(CurrentHook); if CurrentHook0 then SetupGlobalHook:=true; end;Cind ma aflu in applicate totul merge, dar cind apas o tasta in afara aplicatiei "callback_proc(code, wParam, lParam)" nu se apeleaz de atita ca no gaseshte!Cum rezolv problema?//Propuneri cu WM_USER messages sa descrieti, ma intereseaza explicit CALLBACK functions.