1. 程式人生 > >按鍵精靈實現大漠多執行緒操作記事本

按鍵精靈實現大漠多執行緒操作記事本

RunApp "regsvr32 c:\dm.dll /s"
Dimenv hwnd,index:index=0
hwnd = Plugin.Window.SearchEx("Notepad", 0, 0)
For i = 0 To UBound(split(hwnd,"|"))-1
    BeginThread main
    Delay 100'必須加,不然會導致執行緒優先順序錯誤
    index=index+1
Next
Sub main
    Dim hwnds : hwnds =Plugin.Window.FindEx(split(hwnd, "|")(index), 0, "Edit", 0)
    Set dm = CreateObject("dm.dmsoft")
    TracePrint dm.BindWindow(hwnds, "gdi", "windows", "windows", 1)
  Dim i
    Do
        Call dm.KeyPress(49+ (i mod 10))
        Delay 100
        i=i+1
    loop
End Sub