我用WINIO在VB下模拟鼠标左键点击,具体代码如下:
Private Sub XR()
Dim Result As Boolean
Result = SetPortVal(Val("&H64"), Val("&HD3"), 1)
If (Result = False) Then
MsgBox "Whoops ! There is a problem with SetPortByte.", vbOKOnly + vbCritical, "VBDumpPort32"
Unload FrmVBDumpPort32
End If
Sleep 100
Result = SetPortVal(Val("&H64"), Val("&Hf4"), 1)
If (Result = False) Then
MsgBox "Whoops ! There is a problem with SetPortByte.", vbOKOnly + vbCritical, "VBDumpPort32"
Unload FrmVBDumpPort32
End If
Result = SetPortVal(Val("&H60"), Val("&H09"), 1)
If (Result = False) Then
MsgBox "Whoops ! There is a problem with SetPortByte.", vbOKOnly + vbCritical, "VBDumpPort32"
Unload FrmVBDumpPort32
End If
Result = SetPortVal(Val("&H60"), Val("&H00"), 1)
If (Result = False) Then
MsgBox "Whoops ! There is a problem with SetPortByte.", vbOKOnly + vbCritical, "VBDumpPort32"
Unload FrmVBDumpPort32
End If
Result = SetPortVal(Val("&H60"), Val("&H00"), 1)
If (Result = False) Then
MsgBox "Whoops ! There is a problem with SetPortByte.", vbOKOnly + vbCritical, "VBDumpPort32"
Unload FrmVBDumpPort32
End If
Result = SetPortVal(Val("&H60"), Val("&H08"), 1)
If (Result = False) Then
MsgBox "Whoops ! There is a problem with SetPortByte.", vbOKOnly + vbCritical, "VBDumpPort32"
Unload FrmVBDumpPort32
End If
Result = SetPortVal(Val("&H60"), Val("&H00"), 1)
If (Result = False) Then
MsgBox "Whoops ! There is a problem with SetPortByte.", vbOKOnly + vbCritical, "VBDumpPort32"
Unload FrmVBDumpPort32
End If
Result = SetPortVal(Val("&H60"), Val("&H00"), 1)
If (Result = False) Then
MsgBox "Whoops ! There is a problem with SetPortByte.", vbOKOnly + vbCritical, "VBDumpPort32"
Unload FrmVBDumpPort32
End If
End Sub
这个winio没用过,但我用过mouse_event,比较好用.
定义如下:
mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)