man0009大大寫的【VB】 從零開始寫完美外掛 1 的雙開程式能怎樣寫才可直接在視窗名字後自己+數字?
當忘了開視窗就會在第1個視窗後轉了數字
程式要怎改才可變為Element Client<==後面自己打數字?
例: Element Client再開Element Client時尾數是1,再開尾數是2?
因大大的雙開要是忘了開視窗時,第1個視窗是Element Client2,再開就變了22不停的+2....
因為我在學習中,所以要不停開vb來執行,但大大的雙開就不停的+2222.....
請各大大教導學習YCT41B 程式如下:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Dim pid As Long
Private Sub Command1_Click()
Dim proc As Long
proc = FindWindow(vbNullString, Text1.Text)
If proc > 0 Then
GetWindowThreadProcessId proc, pid
Form1.Caption = "遊戲啟動! pid = " & pid
Else
Form1.Caption = "遊戲未啟動"
End If
End Sub
Private Sub Command2_Click()
Dim proc As Long
Dim i As Integer
proc = FindWindow(vbNullString, Text1.Text)
If proc > 0 Then
i = 2
Do While FindWindow(vbNullString, Text1.Text & i) <> 0
DoEvents
i = 1
Loop
Call SetWindowText(proc, Text1.Text & i)
MsgBox "修改完成,請開啟另一個完美世界主程式。"
Else
MsgBox "請先執行完美世界主程式。"
End If
End Sub
YCT41B |