tempad
Readygo技术搜索引擎 >>游戏开发 >> vb中如何限制鼠标移动?急!!

vb中如何限制鼠标移动?急!!

Readygo技术搜索引擎 网络搜索 efish 2008-1-17 2:00:54

vb中如何限制鼠标移动?急!!

楼主capnet(金山)2003-08-05 22:54:55 在 VB / 基础类 提问

vb中如何限制鼠标移动?急!! 问题点数:100、回复次数:3Top

1 楼jacobran()回复于 2003-08-05 22:59:55 得分 100

你自己看吧!  
  Option   ExplicitDeclare   Function   ClipCursor   Lib   "user32"   (lpRect   As   Any)   As   Long  
  Declare   Function   ClipCursorClear   Lib   "user32"   Alias   "ClipCursor"   (ByVal   lpRect   As   Long)   As   Long  
  Declare   Function   ClientToScreen   Lib   "user32"   (ByVal   hwnd   As   Long,   lpPoint   As   POINTAPI)   As   Long  
  Type   RECT  
  Left   As   Long  
  Top   As   Long  
  Right   As   Long  
  Bottom   As   Long  
  End   Type  
  Type   POINTAPI  
  X   As   Long  
  Y   As   Long  
  End   Type  
  Public   RetValue   As   Long  
  Public   ClipMode   As   Boolean  
   
   
  Public   Sub   SetCursor(ClipObject   As   Object,   Setting   As   Boolean)  
  "   used   to   clip   the   cursor   into   the   viewport   and  
  "   turn   off   the   default   windows   cursor  
   
   
  Dim   CurrentPoint   As   POINTAPI  
  Dim   ClipRect   As   RECT  
   
   
  If   Setting   =   False   Then  
  "   set   clip   state   back   to   normal  
  RetValue   =   ClipCursorClear(0)  
  Exit   Sub  
  End   If  
   
   
  "   set   current   position  
  With   CurrentPoint  
  .X   =   0  
  .Y   =   0  
  End   With  
  "   find   position   on   the   screen   (not   the   window)  
  RetValue   =   ClientToScreen(ClipObject.hwnd,   CurrentPoint)  
  "   designate   clip   area  
  With   ClipRect  
  .Top   =   CurrentPoint.Y  
  .Left   =   CurrentPoint.X  
  .Right   =   .Left   +   ClipObject.ScaleWidth  
  .Bottom   =   .Top   +   ClipObject.ScaleHeight  
  End   With   "   clip   it  
  RetValue   =   ClipCursor(ClipRect)  
   
  End   Sub  
  Top

2 楼capnet(金山)回复于 2003-08-05 23:02:52 得分 0

好了,多谢了。Top

3 楼diyee(锦衣夜行)回复于 2003-08-05 23:23:22 得分 0

Option   Explicit  
   
  Type   RECT  
          Left   As   Long  
          Top   As   Long  
          Right   As   Long  
          Bottom   As   Long  
  End   Type  
   
  Declare   Function   ClipCursor   Lib   "user32"   (lpRect   As   Any)   As   Long  
   
   
  Private   Sub   Command1_Click()  
          Dim   r   As   RECT  
           
          r.Left   =   0:   r.Top   =   0  
          r.Right   =   320:   r.Bottom   =   200  
          ClipCursor  
  End   Sub  
   
  Private   Sub   Command2_Click()  
          ClipCursor   ByVal   0&  
  End   Sub  
  Top

责任编辑: efish 参与评论 查找更多:
相关文章
诸位兄弟,本人以前是用VB的,现在想学DELPHI,这里问一… 诸位兄弟,本人以前是用VB的,现在想学DELPHI,这里问一个简单问题
VideoServerPackagev093.zip VideoServerPackagev093.zip
如何清理数据库日志文件 如何清理数据库日志文件
我使用的是InterBase6.5,但发现要将原有的字段长度修… 我使用的是InterBase6.5,但发现要将原有的字段长度修改的少些就不行了,能解决这个问题吗?
在.aspx页面中添加了javascript代码,总体是控件没定… 在.aspx页面中添加了javascript代码,总体是控件没定义?帮忙看看了!
关于手机右软键的问题?(急) 关于手机右软键的问题?(急)
在线等待!Select * from tblname as a inner join … 在线等待!Select * from tblname as a inner join ...
明天开始上班,希望有个好开头,特来散分 明天开始上班,希望有个好开头,特来散分
请求技术支持(有谁知道解偏微分方程的完全多网格法… 请求技术支持(有谁知道解偏微分方程的完全多网格法的主程序的C++代码) ,对提供有用信息的大侠宁愿送所有的分
如何在ASP语句里面实现如javascirpt,vbscript中的弹… 如何在ASP语句里面实现如javascirpt,vbscript中的弹出对话,并将选择的结果返回给ASP语句!
2秒记住本站域名

玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的readygo.com.cn

分类导航
Readygo技术搜索引擎