钩子程序?

LHB20010701 2003-06-19 06:45:58
系统运行时,捕获键盘消息,一旦按下F8键,系统调用一个事件,怎么做?
请大家帮帮忙,谢了!!!
...全文
43 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
outer2000 2003-06-20
  • 打赏
  • 举报
回复
只要把这个写成一个DLL就可以了;
LHB20010701 2003-06-20
  • 打赏
  • 举报
回复
首先感谢楼上
我是要实现整个系统调用,怎么实现内存共享?
好像要写动态DLL
LHB20010701 2003-06-20
  • 打赏
  • 举报
回复
结账
ronaldli 2003-06-20
  • 打赏
  • 举报
回复
已经没什么可说的了
outer2000 2003-06-19
  • 打赏
  • 举报
回复
这个是截获SHIFT的,你看看F8的值, if wparam=VK_SHIFT then
换了就可以了;
outer2000 2003-06-19
  • 打赏
  • 举报
回复
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
function KeyboardHook(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LResult;STDCALL;
var
Form1: TForm1;
WinHook: HHOOK;
implementation

{$R *.dfm}

function KeyboardHook(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LResult;

begin
if (nCode>-1) then
begin
if wparam=VK_SHIFT then
showmessage('your press the shift');
result:=0;
end
else
Result := CallNextHookEx(WinHook, nCode, wParam, lParam);
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
WinHook:=SetWindowsHookEx(WH_KEYBOARD, @KeyboardHook, 0, GetCurrentThreadID);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
UnhookWindowsHookEx(WinHook);
end;

end.

1,184

社区成员

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

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