1、首先将原有的vb模拟器卸载。
2、然后进入浏览器,搜索vb模拟器官网,进入官网后点击下载。
3、最后下载完成后,进行安装,安尘迟装完成后即可使用。拆兄数
我给你做了:源码如下,方向键修改移动方向,空格键移动鼠握李标(若不会整理的话写邮箱and我发过去)VERSION 5.00
Begin VB.Form frmMain
BorderStyle = 1 'Fixed Single
Caption = "鼠标测试"
ClientHeight= 3195
ClientLeft = 45
ClientTop = 330
ClientWidth = 3645
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 3645
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer1
Interval= 10
Left= 120
Top = 480
End
Begin VB.CommandButton btnRight
Caption = "向右移动"
Height = 495
Left= 2520
TabIndex= 3
Top = 1200
Width = 975
End
Begin VB.CommandButton btnLeft
Caption = "向左移动"
Height = 495
Left= 120
TabIndex= 2
Top = 1200
Width = 975
End
Begin VB.CommandButton btnDown
Caption = "向下移动"
Height = 495
Left= 1320
TabIndex= 1
Top = 1920
Width = 975
End
Begin VB.CommandButton btnUp
Caption = "向上移动"
Height = 495
Left= 1320
TabIndex= 0
Top = 480
Width = 975
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'====================================================
' 测试方法: 上下左右键扒搭修改移动方向春皮拿,空格键移动
'====================================================
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Type POINTAPI
X As Long
Y As Long
End Type
Const VK_LEFT = &H25
Const VK_RIGHT = &H27
Const VK_UP = &H26
Const VK_DOWN = &H28
Dim stMousePos As POINTAPI
Dim bMoveType As Long '移动方向
Private Sub Form_Load()
bMoveType = 1 '方向初始化为向上
End Sub
Private Sub Timer1_Timer()
'============== 根据移动方向移动鼠标 ==============
If GetAsyncKeyState(32) Then'空格键
GetCursorPos stMousePos
Select Case bMoveType
Case 1
stMousePos.Y = stMousePos.Y - 10'向上
Case 2
stMousePos.Y = stMousePos.Y + 10'向下
Case 3
stMousePos.X = stMousePos.X - 10'向左
Case 4
stMousePos.X = stMousePos.X + 10'向右
End Select
SetCursorPos stMousePos.X, stMousePos.Y
End If
'============== 根据按键修改移动方向 ==============
If GetAsyncKeyState(VK_LEFT) Then
bMoveType = 3
btnLeft.SetFocus
ElseIf GetAsyncKeyState(VK_RIGHT) Then
bMoveType = 4
btnRight.SetFocus
ElseIf GetAsyncKeyState(VK_UP) Then
bMoveType = 1
btnUp.SetFocus
ElseIf GetAsyncKeyState(VK_DOWN) Then
bMoveType = 2
btnDown.SetFocus
End If
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)