如何区分两个鼠标的输入

cds27 2009-05-20 09:22:50
我想实现的是一个多用户控制。
比如说,一台机器上有两个鼠标,限制其中一个鼠标的移动范围,另一个鼠标则不做限制。
该如何实现?
思路或者技术点?
...全文
244 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
是不是有个Betwin软件的?

我不是学计算机或软件的,说错了别打我~
linamong 2009-05-21
  • 打赏
  • 举报
回复
不太可能
或许可以分辨出鼠标

但是一个限制住 另外一个八成也是限制的

因为上面都说了是一个指针
Learn-anything 2009-05-20
  • 打赏
  • 举报
回复
有难度
jueyingfd 2009-05-20
  • 打赏
  • 举报
回复
这个问题很有难度啊,让我想想!!!!!!!!!!!!!!!!
CqCoder 2009-05-20
  • 打赏
  • 举报
回复
关注···
cds27 2009-05-20
  • 打赏
  • 举报
回复
是的,是同一个指针。

我想实现的就是如果A鼠标操作,会受限制;B鼠标操作,则无限制。
或者有其他的替代方式,可以实现多用户控制也可以。其中一个鼠标输入是受限的,另一个不受限制。
xutao888 2009-05-20
  • 打赏
  • 举报
回复
不知道能不能通过中断号判断是哪个设备输入
xutao888 2009-05-20
  • 打赏
  • 举报
回复
只能从底层入手了
zgke 2009-05-20
  • 打赏
  • 举报
回复
........ 我记忆中好象两个鼠标是一个指针啊.
cds27 2009-05-20
  • 打赏
  • 举报
回复
to zzxap:
限制鼠标范围,现在不是我的难点。我现在的难点在于,A鼠标限制,B鼠标不限制,该如何实现?
hecker728 2009-05-20
  • 打赏
  • 举报
回复
看看
W422080367 2009-05-20
  • 打赏
  • 举报
回复
关注 UP
zzxap 2009-05-20
  • 打赏
  • 举报
回复
void button1_Click(object sender, EventArgs e)
{
Rectangle clipRectangle = this.panel1.RectangleToScreen( this.panel1.ClientRectangle );
System.Windows.Forms.Cursor.Clip = clipRectangle;
}
zzxap 2009-05-20
  • 打赏
  • 举报
回复
int titleHeight = System.Windows.Forms.SystemInformation.CaptionHeight;
Point myFormPoint = this.PointToScreen(new Point(0,0-titleHeight));
Rectangle rect = new Rectangle(myFormPoint, new Size(this.ClientRectangle.Width,this.ClientRectangle.Height + titleHeight));
System.Windows.Forms.Cursor.Clip = rect;
zzxap 2009-05-20
  • 打赏
  • 举报
回复 1
[code=C#]
利用api 函数 ClipCursor和GetWindowRect可以实现限定鼠标移动范围的功能。

[System.Runtime.InteropServices.DllImport("user32", EntryPoint = "ClipCursor")]
public extern static int ClipCursor(ref RECT lpRect);
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "GetWindowRect")]
public extern static int GetWindowRect(int hwnd, ref RECT lpRect);

public struct RECT//声明参数的值
{
public int left;
public int top;
public int right;
public int bottom;
}
public void Lock(System.Windows.Forms.Form ObjectForm)
{
RECT _FormRect = new RECT();
GetWindowRect(ObjectForm.Handle.ToInt32(), ref _FormRect);
ClipCursor(ref _FormRect);
}
public void UnLock()
{
RECT _ScreenRect = new RECT();

_ScreenRect.top = 0;
_ScreenRect.left = 0;
_ScreenRect.bottom = int.MaxValue; ;
_ScreenRect.right = int.MaxValue;
ClipCursor(ref _ScreenRect);
}
private void bntKong_Click(object sender, EventArgs e)
{
this.Lock(this);
}

private void bntMove_Click(object sender, EventArgs e)
{
this.UnLock();
}
[/CODE]
wlzx21 2009-05-20
  • 打赏
  • 举报
回复
关注~~~~

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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