VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3
Begin VB.Timer Timer3
Left = 1320
Top = 120
End
Begin VB.Timer Timer2
Left = 120
Top = 120
End
Begin VB.Timer Timer1
Left = 720
Top = 120
End
Begin VB.CommandButton Command1
Caption = "开始"
Height = 375
Left = 1800
TabIndex = 0
Top = 2400
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Const WM_GETTEXT = &HD
Private Const WM_SETTEXT = &HC
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const WM_GETTEXTLENGTH = &HE
Private Const VK_TAB = &H9
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
Private Const GW_HWNDFIRST = 0
Dim p As Long
Dim Pcount As Long
Dim DataP As Long
Dim DataPcount As Long
Dim Pzs As Long
Dim FormID As Long
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
Pzs = 0
Timer1.Interval = 3000
End Sub
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
MsgBox (KeyCode)
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 0
If Pzs = 0 Then DataNew
Timer2.Interval = 100
End Sub
Private Sub Timer2_Timer()
Timer2.Interval = 0
If DataP < DataPcount Then
p = 0
Timer3.Interval = 100
DataP = DataP + 1
Else
Timer2.Interval = 0
DataSave
DataNext
End If
End Sub
Private Sub Timer3_Timer()
If DataP < DataPcount Then
SetGridDataJ 1, 1
End If
If DataP = DataPcount Then
SetGridDataEnd 1, 1
End If
p = p + 1
If p > Pcount Then
Timer3.Interval = 0
Timer2.Interval = 100
End If
End Sub
Private Sub SetData(data As String)
Clipboard.SetText data
PasteKey
End Sub
Private Sub DataNew()
FormID = GetForegroundWindow()
FindCont = 0
If Pzs = 0 Then SetDataW FormID, " ", "TComboBox", 1
keybd_event 17, 0, 0, 0
keybd_event 78, 0, 0, 0
keybd_event 78, 0, 2, 0
keybd_event 17, 0, 2, 0
FindCont = 0
SetDataW FormID, Str(Pzs), "TSpinEdit", 1
DataP = 0
DataPcount = Pzs + 2
End Sub
Private Sub DataNext()
Pzs = Pzs + 1
FormID = GetForegroundWindow()
FindCont = 0
If Pzs = 1 Then SetDataW FormID, " ", "TComboBox", 1
If Pzs = 2 Then SetDataW FormID, " ", "TComboBox", 1
keybd_event 17, 0, 0, 0
keybd_event 78, 0, 0, 0
keybd_event 78, 0, 2, 0
keybd_event 17, 0, 2, 0
FindCont = 0
SetDataW FormID, Str(Pzs), "TSpinEdit", 1
DataP = 0
DataPcount = Pzs + 2
If Pzs < 3 Then
Timer1.Interval = 100
End If
End Sub
Private Sub SetDataM(data As String)
For i = 1 To Len(data)
KeyDown Asc(Mid(data, i))
Next
End Sub
Private Sub SetGridDataJ(h As Long, l As Long)
Dim Wid As Long
Pcount = 5
If p = 0 Then
SetData " " & DataP
KeyDown 13
End If
If p = 1 Then
SetData "504"
KeyDown 13
End If
If p = 2 Then
KeyDown 13
End If
If p = 3 Then
SetData "001"
For i = 1 To 3
KeyDown 13
Next
End If
If p = 4 Then
SetDataM 1000 * DataP + 1859
KeyDown 9
End If
If p = 5 Then
SetDataM 0
KeyDown 9
End If
End Sub
Private Sub SetGridDataT(h As Long, l As Long)
Pcount = 5
If p = 0 Then
SetData " " & DataP
KeyDown 13
End If
If p = 1 Then
SetData "504"
KeyDown 13
End If
If p = 2 Then
KeyDown 13
End If
If p = 3 Then
SetData "001"
End If
If p = 4 Then
SetDataM 0
KeyDown 9
End If
If p = 5 Then
SetDataM 1000 * DataP + 1859
KeyDown 9
End If
End Sub
Private Sub SetGridDataEnd(h As Long, l As Long)
Pcount = 5
If p = 0 Then
SetData " " & DataP
KeyDown 9
End If
If p = 1 Then
SetData "102"
KeyDown 9
End If
If p = 2 Then
KeyDown 9
End If
If p = 3 Then
SetData "001"
For i = 1 To 6
KeyDown 13
Next
End If
If p = 4 Then
KeyDown 9
End If
If p = 5 Then
End If
End Sub
Sub KeyDown(Key As Long)
keybd_event Key, 0, 0, 0
keybd_event Key, 0, 2, 0
End Sub
Sub PasteKey()
keybd_event 17, 0, 0, 0
keybd_event 86, 0, 0, 0
keybd_event 86, 0, 2, 0
keybd_event 17, 0, 2, 0
End Sub
Sub DataSave()
keybd_event 17, 0, 0, 0
keybd_event 83, 0, 0, 0
keybd_event 83, 0, 2, 0
keybd_event 17, 0, 2, 0
End Sub