Project1

标题: API问题2 [打印本页]

作者: yangff    时间: 2008-2-19 05:33
标题: API问题2
上一个问题已经解决
但是还有问题
工程(其中包含了经过处理的DLL):
http://rpg.blue/upload_program/files/鼠标_83798993.rar
-----------------------------------
声明API都没问题,但是一旦调用(哪怕是给变量赋值)立马死机!
VB代码如下:
  1. Private Type POINTAPI
  2. x As Long
  3. Y As Long
  4. End Type
  5. Dim p As POINTAPI
  6. Dim l As Long
  7. Dim hd As Long
  8. Dim KeyTepy As Integer
  9. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  10. Private Declare Function ScreenToClient Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long
  11. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
  12. Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
  13. Private Function Get_Pos_X() As Long
  14. If p.x < 0 Then
  15.   p.x = 0
  16. End If
  17. If p.x > 544 Then
  18.   p.x = 544
  19. End If
  20. Get_Pos_X = p.x
  21. End Function
  22. Private Function Get_Pos_Y() As Long
  23. If p.Y < 0 Then
  24.   p.Y = 0
  25. End If
  26. If p.Y > 416 Then
  27.   p.Y = 416
  28. End If
  29. Get_Pos_Y = p.Y
  30. End Function
  31. Private Function Get_Left() As Integer
  32.   Get_Left = 0
  33.   If KeyTepy = 1 Then
  34.     Get_Left = 1
  35.   End If
  36. End Function
  37. Private Function Get_Right() As Integer
  38.   Get_Right = 0
  39.   If KeyTepy = 2 Then
  40.     Get_Right = 1
  41.   End If
  42. End Function
  43. Private Function Updata_Mouse() As Long
  44. If Mouse_Open = True Then
  45.    Call GetCursorPos(p)
  46.    l = ScreenToClient(hd, p)
  47.    Dim x     As Long
  48.    x = GetAsyncKeyState(1)       '左键
  49.    KeyTepy = 0
  50.    If x = -32767 Then
  51.      KeyTepy = 1
  52.    End If
  53.    
  54.    x = GetAsyncKeyState(2)       '右键
  55.    If x = -32767 Then
  56.      KeyTepy = 2
  57.    End If
  58.    Updata_Mouse = 0
  59. Else
  60.    Updata_Mouse = 1
  61. End If
  62. End Function
  63. Sub Mouse_Close()
  64.    ShowCursor (1)
  65.    l = ""
  66.    hd = ""
  67.    KeyTepy = ""
  68.     Mouse_Open = False
  69. End Sub
  70. Private Function Mouse_Start(hWnd As Long) As Long
  71.    ShowCursor (0)
  72.    hd = hWnd
  73.    Mouse_Open = True
  74.    Mouse_Start = 0
  75. End Function
复制代码

[LINE]1,#dddddd[/LINE]----------------版务----------------
如果问题未解决,请继续提问
如果问题已解决,请结贴
若到末贴发贴时间后一周仍未结贴
管理员会自动为你过期帖子、结贴或强行认可答案。
[LINE]1,#dddddd[/LINE]此贴于 2008-2-22 0:28:39 被版主凌冰提醒,请楼主看到后对本贴做出回应。 [LINE]1,#dddddd[/LINE]此贴于 2008-2-22 0:41:23 被版主凌冰提醒,请楼主看到后对本贴做出回应。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1