cWndState

Get the current state of a window or control.

Syntax:

cWndState(window-handle / control-handle)

Parameters:

(i) hWnd handle to window or control .

Returns:

(i) Desired Information. See Below.

Possible return values for a window:

Constant

Value

Description

@HIDDEN

-1

Specified window exists, but is hidden.

@FALSE

0

Specified window does not exist.

@ICON

1

Specified window is iconic (minimized).

@NORMAL

2

Specified window is a normal window.

@ZOOMED

3

Specified window is zoomed (maximized).

 

Possible return values for a control:

Constant

Value

Description

@HIDDEN

-1

Specified control exists, but is hidden.

@FALSE

0

Specified control does not exist.

@NORMAL

2

Specified control is visible.

 

This function returns the current state of the window or control specified by the handle. If a window handle is specified, cWndState is similar to the WIL WinState except that it accepts a window handle as the parameter instead of a partial window name.

 

Example:

AddExtender("wwctl44i.dll",0,"wwctl64i.dll")
sAppName= "Notepad.exe"
sAppWindow = "~Notepad"
sAppClass = "NotePad"
; Find Notepad
TestApp = FileLocate (sAppName)
If TestApp == "" Then Goto Error
; Start notepad
If !ShellExecute(TestApp, "", "", @ICON, "") Then Goto Error
If !WinWaitExist(sAppWindow, 16) Then Goto Error
hWnd = cFindClass(sAppClass)
If !hWnd Then Goto Error
; Did it start minimized?
If cWndState( hWnd ) == @ICON
   Message(" Success", "Notepad is minimized.")
   Goto done
EndIf
:Error
Message("Error!", "This script didn’t work.")
:done
If WinExist(sAppWindow)
   WinClose(sAppWindow)
EndIf
Exit

See Also:

cFindbyClass , DllHwnd