Function Reference


HWnd

Converts an expression into an HWND handle.

HWnd ( expression )

Parameters

expression An expression to convert into an HWND handle.

Return Value

Success: If the value can be converted to an HWND, the HWND representation will be returned.
Failure: If the HWND does not denote a valid window, a 0 (NULL) HWND will be returned and sets the @error flag to 1.

Remarks

Double numbers can not be converted to an HWND.
No literal string should be converted to an HWND because there is no guarantee that a given window will have the same HWND ever again. This is not strictly forbidden, but it is a programming mistake and should be avoided.

Related

Int, Number, Ptr, String

Example

Example()
Func  Example()
; Run Notepad
Run ("notepad.exe")
; Wait 10 seconds for the Notepad window to appear.
Local $hWnd= WinWait ("[CLASS:Notepad]","",10)
; Convert the handle to a string.
Local $sHWnd= String ($hWnd)
; Minimize the Notepad window and wait for 2 seconds.
WinSetState (HWnd ($sHWnd),"",@SW_MINIMIZE )
Sleep (2000)
; Restore the Notepad window and wait for 2 seconds.
WinSetState (HWnd ($sHWnd),"",@SW_RESTORE )
Sleep (2000)
; Close the Notepad window.
WinClose (HWnd ($sHWnd))
EndFunc ;==>Example

AltStyle によって変換されたページ (->オリジナル) /