多线程同步操作多个窗口 RunApp "notepad
exe" RunApp "notepad
exe" RunApp "notepad
exe" Delay 2000 Dimenv temp_Hwnd temp_Hwnd = 0 Dim str, arr, i str = Plugin
Window
Search("无标题 - 记事本") arr = Split(str, "|") For i = 0 To UBound(arr) - 1 temp_Hwnd = Plugin
Window
FindEx(arr(i), 0, "Edit", 0) BeginThread WriteString While temp_Hwnd 0'判断多线程已经启动完毕,继续循环下一个
Delay 500 Wend Next EndScript Function WriteString() Dim str, Hwnd Hwnd = temp_Hwnd temp_Hwnd = 0 Do str = WaitKey If Hwnd Plugin
Window
GetKeyFocusWnd Then Call Plugin
KeyPress(Hwnd, str) End If Loop End Function 多线程多开窗口同步执行与子线程间的数值如何传递: 1
Dimenv IsThread, i 2
Dim arr_Thread() 3
For i = 0 To 2 4
IsThread = False'未启动线程 5
Redim Preserve arr_Thread(i) 6
arr_Thread(i) = BeginThread(EnterThread) 7
While IsThread = False'未启动成功,等待中