unit unit_mouse;
interface
uses
windows, messages, sysutils, variants, classes, graphics, controls, forms,
dialogs, stdctrls, menus;
{=======================================================
design by : 花好月圆 / 玉面书生
date: 2005-01-30
site: http://www.eastrise.cn/quick2004
blog: http://blog.csdn.net/jackie168
email: joe-lu@163.com
文章为作者原创,转载前请先与本人联系,转载请注明文章出处、保留作者信息,谢谢支持!
=======================================================}
type
tform1 = class(tform)
popupmenu1: tpopupmenu;
n1: tmenuitem;
procedure n1click(sender: tobject);
private
{ private declarations }
public
{ public declarations }
end;
var
form1: tform1;
i:integer; //全局变量
implementation
{$r *.dfm}
//自写函数
function proc(icode:integer;wparam:wparam;lparam:lparam):lresult;stdcall;
var
evtmsg:teventmsg;
begin
evtmsg:=peventmsg(lparam)^;
form1.left:=mouse.cursorpos.x+10;
form1.top:=mouse.cursorpos.y+10;
if evtmsg.message=wm_rbuttonup then
form1.n1.click;
end;
procedure tform1.n1click(sender: tobject);
begin
n1.checked:= not n1.checked;
if n1.checked then
i:=setwindowshookex(wh_journalrecord,proc,hinstance,0)
else
unhookwindowshookex(i);
top:=(screen.height-height)div 2;
left:=(screen.width - width-55) div 2;
end;
end.