AutoIT: WinSetState可以定义窗口大小
阅读原文时间:2023年07月11日阅读:1

Example()
FuncExample()
; Run Notepad
Run("notepad.exe")
; Wait seconds for the Notepad window toappear.
Local $hWnd =WinWait("[CLASS:Notepad]", "", )
MsgBox(,"Test1", $hWnd, )
; Convert the handle to a string.
Local $sHWnd = String($hWnd)
MsgBox(,"Test2", $sHWnd, )
; Minimize the Notepad window and wait for2 seconds.
WinSetState(HWnd($sHWnd), "",@SW_MINIMIZE)
Sleep()

; Restore the Notepad window and wait for 2seconds.  
WinSetState(HWnd($sHWnd), "",@SW\_RESTORE)  
Sleep()  
MsgBox(,"Test3", HWnd($sHWnd))  
WinClose(HWnd($sHWnd)) ; Close the Notepadwindow.  
MsgBox(,"Test4", HWnd($sHWnd))  

EndFunc