怎样使鼠标象没有一样(不光是屏蔽,是不显示也不能按) 怎样使鼠标象没有一样(不光是屏蔽,是不显示也不能按) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你可以把鼠标限制在某个区域里(角落),以下是参考函数:procedure TForm1.Button1Click(Sender: TObject); var btButton2: TRect; begin btButton2 := Button2.BoundsRect; MapWindowPoints(handle, 0, btButton2, 2); // 座标换算 ClipCursor(@btButton2); // 限制鼠标移动区域 end; // 还原 procedure TForm1.Button2Click(Sender: TObject); var btScreen: TRect; begin btScreen := Rect(0, 0, Screen.Width, Screen.Height); ClipCursor(@btScreen); end; unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1; HookHandle: HHOOK = 0;implementation{$R *.dfm}function Mouse(code: Integer; wParam, lParam: Longint):Longint;stdcall;begin Result:=1;end;procedure TForm1.Button1Click(Sender: TObject);begin ShowCursor(False); HookHandle:=SetWindowsHookEx(WH_MOUSE,Mouse,HInstance,0);end;procedure TForm1.Button2Click(Sender: TObject);begin UnhookWindowsHookEx(HookHandle); ShowCursor(True);end;end. 真棒兄,经你的启发,这样应该更简单些: ShowCursor(false); SetCursorPos(0,0); //Disable Mouse ShowCursor(true); SetCursorPos(100,100); //Enable Mouse TREEVIEW读取数据库数据分层问题 求救!!用一个服务程序来控制windowsXP的登录! 有个小问题!! qreport报表制作 vc的dll中函数里需要外部给一个十六进制的int数(比如0x1,0x2)delphi调用时我给了$01,$02,非法操作,why? 请问如何让 dbchart 显示 百分比 啊!在线~ 关于扫雷游戏的问题 如何将delphi6中的日期时间转化为access97支持的格式?急切等待!!! 如何将ListView中的节点存储文件中??? 怎样用DELPHI做历史记录? 请教一个关于mapinfo的问题 帮忙,散分!!!
procedure TForm1.Button1Click(Sender: TObject);
var
btButton2: TRect;
begin
btButton2 := Button2.BoundsRect;
MapWindowPoints(handle, 0, btButton2, 2); // 座标换算
ClipCursor(@btButton2); // 限制鼠标移动区域
end; // 还原
procedure TForm1.Button2Click(Sender: TObject);
var
btScreen: TRect;
begin
btScreen := Rect(0, 0, Screen.Width, Screen.Height);
ClipCursor(@btScreen);
end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
HookHandle: HHOOK = 0;implementation{$R *.dfm}function Mouse(code: Integer; wParam, lParam: Longint):Longint;stdcall;
begin
Result:=1;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
ShowCursor(False);
HookHandle:=SetWindowsHookEx(WH_MOUSE,Mouse,HInstance,0);
end;procedure TForm1.Button2Click(Sender: TObject);
begin
UnhookWindowsHookEx(HookHandle);
ShowCursor(True);
end;end.
SetCursorPos(0,0);
//Disable Mouse ShowCursor(true);
SetCursorPos(100,100);
//Enable Mouse