cWndGetWndSpec

Creates a window specification from the window handle.

Syntax:

cWndGetWndSpec( window-handle)

Parameters:

(i) window-handle Window handle of top-level window to create specification for.

Returns:

(s) window-specification Specification of indicated window.

 

This function is a script development tool that creates a window specification from the window handle you supply as the only parameter. You can save window specifications in WIL scripts as the parameters to the cWndByWndSpec function. This allows you to more accurately obtain an application's top-level window handle than by using the DLLhwnd function with a window title. The window specification is a more precise window identification method than the window title approach, because applications often change their titles on the fly and partial window titles can identify more than one application's top-level window.

The function's parameter must be the window handle to an existing top-level window. A top-level window is any window that does not have the WS_CHILD style and is usually the main window of an application. The function will generate an error if the passed in window handle is not to a top-level window.

The window specification consists (in order) of the window's class name, module name, number of child windows and child window ids. Specification elements are separated by comas (,). The module name is the name of the executable or DLL file that is responsible for the window. It does not include the file name's path or extension. Both the class name and module name are surrounded by double quotes ("). There is a limit of 13 child windows allowed. You can obtain the window specification of a window with more than 13 child windows but only the first thirteen will be included in the specification.

UAC Notes: attempting to query information about an elevated process may cause the function to error when executed from a restricted user account.

 

Example:

AddExtender("wwctl44i.dll",0,"wwctl64i.dll")

; Find Notepad's Windows handle hwnd = DllHwnd("~Notepad") ; Get the window specification. Spec = cWndGetWndSpec(hwnd) ; Get the handle by the window specification. hWndSpec = cWndByWndSpec(%Spec%) ; Make sure the result matches the original handle If hwnd == hWndSpec Then Message("Window Spec is correct", Spec) Else Message("Window Spec is NOT correct", Spec) Exit

See Also:

cWndByWndSpec, cWndGetWndSpecName, cWndByName