| 
 
| 赞 | 12 |  
| VIP | 107 |  
| 好人卡 | 6 |  
| 积分 | 4 |  
| 经验 | 31122 |  
| 最后登录 | 2024-6-29 |  
| 在线时间 | 1606 小时 |  
 Lv2.观梦者 傻♂逼 
	梦石0 星屑374 在线时间1606 小时注册时间2007-3-13帖子6562  
 | 
| 
上一个问题已经解决
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  但是还有问题
 工程(其中包含了经过处理的DLL):
 http://rpg.blue/upload_program/files/鼠标_83798993.rar
 -----------------------------------
 声明API都没问题,但是一旦调用(哪怕是给变量赋值)立马死机!
 VB代码如下:
 
 复制代码Private Type POINTAPI
x As Long
Y As Long
End Type
Dim p As POINTAPI
Dim l As Long
Dim hd As Long
Dim KeyTepy As Integer
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Function Get_Pos_X() As Long
If p.x < 0 Then
  p.x = 0
End If
If p.x > 544 Then
  p.x = 544
End If
Get_Pos_X = p.x
End Function
Private Function Get_Pos_Y() As Long
If p.Y < 0 Then
  p.Y = 0
End If
If p.Y > 416 Then
  p.Y = 416
End If
Get_Pos_Y = p.Y
End Function
Private Function Get_Left() As Integer
  Get_Left = 0
  If KeyTepy = 1 Then
    Get_Left = 1
  End If
End Function
Private Function Get_Right() As Integer
  Get_Right = 0
  If KeyTepy = 2 Then
    Get_Right = 1
  End If
End Function
Private Function Updata_Mouse() As Long
If Mouse_Open = True Then
   Call GetCursorPos(p)
   l = ScreenToClient(hd, p)
   Dim x     As Long
   x = GetAsyncKeyState(1)       '左键
   KeyTepy = 0
   If x = -32767 Then
     KeyTepy = 1
   End If
   
   x = GetAsyncKeyState(2)       '右键
   If x = -32767 Then
     KeyTepy = 2
   End If
   Updata_Mouse = 0
Else
   Updata_Mouse = 1
End If
End Function
Sub Mouse_Close()
   ShowCursor (1)
   l = ""
   hd = ""
   KeyTepy = ""
    Mouse_Open = False
End Sub
Private Function Mouse_Start(hWnd As Long) As Long
   ShowCursor (0)
   hd = hWnd
   Mouse_Open = True
   Mouse_Start = 0
End Function
 ----------------版务----------------
 如果问题未解决,请继续提问
 如果问题已解决,请结贴
 若到末贴发贴时间后一周仍未结贴
 管理员会自动为你过期帖子、结贴或强行认可答案。
 此贴于 2008-2-22 0:28:39 被版主凌冰提醒,请楼主看到后对本贴做出回应。
 此贴于 2008-2-22 0:41:23 被版主凌冰提醒,请楼主看到后对本贴做出回应。
 | 
 |