請問會VB的大大
為什麼我這樣寫 程式開始跑的時候會非常LAG@@?
Private Sub Timer1_Timer()
If GetPid = 0 Then '偵測遊戲是否啟動
Text2.Text = "程序還未打開"
Text2.ForeColor = QBColor(12)
Timer2.Enabled = False
Timer3.Enabled = False
Else
Text2.Text = "程序打開"
Text2.ForeColor = QBColor(2)
Timer2.Enabled = True
Timer3.Enabled = True
End If
End Sub
Private Sub Timer2_Timer()
Dim NotepadHwnd As Long, hWnd As Long
Label2 = " HP : " & ReadMemoryValue(ReadMemoryValue(ReadMemoryValue(&HA5BFCC) + &H20) + &H474) & " / " & ReadMemoryValue(ReadMemoryValue(ReadMemoryValue(&HA5BFCC) + &H20) + &H4B4)
Label6 = " MP : " & ReadMemoryValue(ReadMemoryValue(ReadMemoryValue(&HA5BFCC) + &H20) + &H478) & " / " & ReadMemoryValue(ReadMemoryValue(ReadMemoryValue(&HA5BFCC) + &H20) + &H4B8)
Label7 = " SP : " & ReadMemoryValue(ReadMemoryValue(ReadMemoryValue(&HA5BFCC) + &H20) + &H488) & " / " & ReadMemoryValue(ReadMemoryValue(ReadMemoryValue(&HA5BFCC) + &H20) + &H534)
If ReadMemoryValue(ReadMemoryValue(ReadMemoryValue(&H109F7B8) + &H1088) + &H38) <> 1 And Check3.value = 1 Then
NotepadHwnd = FindWindow("elementclient.exe", vbNullString)
hWnd = FindWindowEx(NotepadHwnd, 0, "ElementClient Window", vbNullString)
PostMessage hWnd, WM_KEYDOWN, 9, 0
Sleep 500
PostMessage hWnd, WM_KEYUP, 9, 0
End If
If Check2(5).value = 1 And Text3(5).Text <> " " Then
If ReadMemoryValue(ReadMemoryValue(ReadMemoryValue(ReadMemoryValue(&H109F7B8) + &H100C) + &H14) + &H38) < 750 Then
NotepadHwnd = FindWindow("elementclient.exe", vbNullString)
hWnd = FindWindowEx(NotepadHwnd, 0, "ElementClient Window", vbNullString)
ee = ff(Combo2(5).Text)
PostMessage hWnd, WM_KEYDOWN, ee, 0
Sleep 100
PostMessage hWnd, WM_KEYUP, ee, 0
End If
End If
End Sub
Private Sub Timer3_Timer()
Dim q
Dim NotepadHwnd As Long, hWnd As Long
w = Mid(Time, 10, 2)
If w <> r Then
s = s + 1
For q = 0 To 3
If Check1(q).value = 1 And a(q) = 0 Then
a(q) = Text1(q)
ee = ff(Combo1(0).Text)
NotepadHwnd = FindWindow("elementclient.exe", vbNullString)
hWnd = FindWindowEx(NotepadHwnd, 0, "ElementClient Window", vbNullString)
PostMessage hWnd, WM_KEYDOWN, ee, 0
Sleep 200
PostMessage hWnd, WM_KEYUP, ee, 0
Else
If Check1(q).value = 1 Then a(q) = a(q) - 1
End If
Label1(q) = a(q)
Next q
r = w
End If |