Project1
标题:
API问题2
[打印本页]
作者:
yangff
时间:
2008-2-19 05:33
标题:
API问题2
上一个问题已经解决
但是还有问题
工程(其中包含了经过处理的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
复制代码
[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