您现在的位置: 论文网 >> 计算机论文 >> 计算机应用论文 >> 在应用程序中跟踪MOUSE的坐标论文

在应用程序中跟踪MOUSE的坐标

作者:未知
出处:论文网
时间:2007-04-12


begin
end;
WM_NCMouseMove, WM_MOUSEMOVE:
begin
mydata(pmem^).data2:=pMOUSEHOOKSTRUCT(lparam)^;
// messagebeep(1);
//SendMessage(DataBuf(pMem^)[1],DataBuf(pMem^)[2],wParam,lParam );
SendMessage(mydata(pMem^).data1[1],mydata(pMem^).data1[2],wParam,integer(@(mydata(pmem^).data2)) );
end;
end; //发送消息
end; function OpenGetKeyHook(sender : HWND;MessageID : WORD) : BOOL; export;
begin
Result := False;
if NextHook $#@60;$#@62; 0 then Exit; //已经安装了本钩子
// DataBuf(pMem^)[1] := Sender; //填数据区
// DataBuf(pMem^)[2] := MessageID; //填数据区
mydata(pmem^).data1[1]:=sender;
mydata(pmem^).data1[2]:=messageid; NextHook := SetWindowsHookEx(WH_mouse, HookHandler, Hinstance, 0);
Result := NextHook $#@60;$#@62; 0;
end; function CloseGetKeyHook: BOOL; export;
begin
if NextHook $#@60;$#@62; 0 then
begin
UnhookWindowshookEx(NextHook); //把钩子链链接到下一个钩子处理上.
NextHook := 0;
end;
Result := NextHook = 0;
end; end.   第三步,测试DLL,建一PROJECT。关键在于override WndProc unit Unit1; interface uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls; type
TForm1 = class(Tform)
uncapture: Tbutton;
capture: Tbutton;
Exit: Tbutton;
Panel1: Tpanel;
show: Tlabel; Label1: Tlabel;
counter: Tlabel;
procedure ExitClick(Sender: Tobject);
procedure uncaptureClick(Sender: Tobject);
procedure captureClick(Sender: Tobject);
private
{ Private declarations }
public
{ Public declarations }
procedure WndProc(var Message: Tmessage); override;
end; var
Form1: TForm1;
var num : integer;
const MessageID = WM_User + 100;
implementation {$R *.DFM}
function OpenGetKeyHook(sender : HWND;MessageID : WORD) : BOOL; external GetKey.DLL;
function CloseGetKeyHook: BOOL; external GetKey.DLL; procedure TForm1.ExitClick(Sender: Tobject);
begin
close;
end; procedure TForm1.uncaptureClick(Sender: Tobject);
begin
if CloseGetKeyHook then //ShowMessage(结束记录...);
show.caption:=结束记录...;
end; procedure TForm1.captureClick(Sender: Tobject);
begin
// if OpenGetKeyHook(self.Handle,MessageID) then ShowMessage(开始记录...); if OpenGetKeyHook(Form1.Handle,MessageID) then
//ShowMessage(开始记录...);
show.caption:=开始记录...;
num := 0;
end; procedure TForm1.WndProc(var Message: Tmessage);
var x,y:integer;
begin
if Message.Msg = MessageID then
begin
// Panel1.Caption := IntToStr(Num);
x:=PMouseHookStruct( message.lparam)^.pt.x ;
y:=PMouseHookStruct( message.lparam)^.pt.y ; panel1.caption:=x=+inttostr(x)+ y=+inttostr(y);
inc(Num);
counter.Caption := IntToStr(Num);
end
else Inherited;
end; end.

上一页 [1] [2]

论文搜索
关键字:应用程序 MOUSE
最新计算机应用论文
基于网络信息安全技术管理的计算机应用研究
浅析人工智能体系建设
抖音短视频平台视频推荐模式研究
应用电子技术中可编程控制器的应用探讨
用友NC信息系统的实施应用实践研究
基于校园一卡通数据系统的学生行为分析研究
云环境下基于蚁群算法的动态容错技术研究
自拍图像中的记忆痕迹
抖音短视频用户使用动机研究
基于创新扩散理论的Vlog传播
热门计算机应用论文
学生成绩管理系统的设计与实现
浅析计算机病毒及防范的措施
学籍管理系统软件
对计算科学与计算机发展的思考
计算机应用型人才的培养模式研究
物资管理信息系统开发
计算机信息管理在第三方物流中的应用
嵌入式系统数字图像采集接口电路设计
基于B/S体系结构开发应用系统
项目管理在软件中的应用