关于记录键盘的程序,不知怎么改,进来看一下(100分)

to wlyft:不知道你的问题解决了没有,我也想知道是如何解决的,
我想知道如何记录!@##$%^^&&*&这个问题,还有汉字的问题。
我用的日志钩子,没有用键盘钩子,谢谢
MY QQ:485557
 
我更改的一段代码段,实现记录小写字母和符号、功能键的功能

function KeyProc(Code:integer;wpara:WPARAM;lpara:LPARAM):LRESULT ;stdcall;
const
_KeyPressMask = $80000000;
var
KN:pChar;tmpRes:Integer; KS:TKeyBoardState; ch:String;
begin
Result:=0;
if Code < 0 then
begin
Result := CallNextHookEx(TheRecorder.HookHandle, Code, wpara, lpara);
exit;
end;
if (lpara and _KeyPressMask)=0 then
begin
KN:=StrAlloc(2);
if GetKeyboardState(KS)=False then exit;
tmpRes:=ToAscii(wpara,lpara,KS,KN,0);
if (tmpRes=1) and not(Ord(String(KN)[1])in CtlChars) then begin
ch:=String(KN)[1];
if ord(ch[1])=13 then ch:=ch+#10;
tofileproc('c:/recorderdata2.txt',ch);
form1.txtstatus.Text:=form1.txtstatus.Text+ch;
end else begin
KN:=StrAlloc(10);
if GetKeyNameText(lpara,KN,10)<> 0 then begin
tofileproc('c:/recorderdata2.txt','{'+String(KN)+'}');
form1.txtstatus.Text:=form1.txtstatus.Text+'{'+String(KN)+'}';
end;
end;
end;
end;

tofileproc过程:
procedure tofileproc(filename,ch:string);
var f:textfile;
begin
try
assignfile(f,'c:/recoderdata2.txt');
if not fileexists('c:/recoderdata2.txt') then rewrite(f);
append(f);
write(f,ch);
write(f,'|');
finally
closefile(f);
end;

end;
 
to lunni
还是不懂!!!
 
向前提一步 吧,等高手来
 
顶部