Determines if a child window of the specified parent exists.
cWndExist (window-handle, window-info, info-type)
(i) window-handle parent windows handle.
(i/s) child-attribute either window name, window sequence, window id or window class
(i) attribute-type 1 = window name, 2 = window sequence, 3 = window id, 4 = window class
(i) Window-handle Windows handle if found, otherwise, 0
Use this function to determine if a child window of the specified parent exists. It can also be used to obtain the Window’s handle that can be passed to other Control Manager functions. The function searches for a child window based on the window attribute in the second parameter. You need to tell the function about the content of the attribute by placing a number from 1 to 4 in the third parameter (see the table below).
The return value is the Windows handle to the child window with the specified attribute. If no child with the attribute can be found, the function will return 0.
This function is a combination of the four Control Manager "By" functions; cWndByName, cWndBySeq, cWndById and cWndByClass. The main difference is that this function returns immediately, if the window with the indicated attribute does not exist. The four "By" functions will make multiple attempts at finding a window. These attempts can delay a script for up to 8 seconds when the child window does not exist.
If the child attribute specified is a window-name, See "Partial Window Names" for a detailed explanation of the rules governing, partial window namesl.
The number in the third parameter has the following meanings:
Value |
Description |
Function |
1 |
The text is the child window caption. |
cWndByName |
2 |
The number is the sequence number of the child window. |
cWndBySeq |
3 |
The number is the Id number of the child window. |
cWndById |
4 |
The text is the class name of the child window. |
cWndByClass |
AddExtender("wwctl44i.dll",0,"wwctl64i.dll") ; Give some symbolic names to the "by" method parameter. ByName = 1 ByClass = 4 ById = 3 BySeq = 2 appName = "YATS32" hwnd = DllHwnd(appName) ; Test by class. ClassName = "ListBox" hwnd1 = cWndexist(hwnd, ClassName, ByClass) hwnd2 = cWndbyclass(hwnd, ClassName) If hwnd1 != hwnd2 Goto SlowWindowFound EndIf ; Test by name. WindowName = "Time Servers" hwnd1= cWndbyname(hwnd, WindowName) hwnd2= cWndexist(hwnd, WindowName, ByName) If hwnd1 != hwnd2 Goto SlowWindowFound EndIf ; Test by Control Id. WindowId = 65535 hwnd1 = cWndexist(hwnd, WindowId , ById) hwnd2 = cWndbyid(hwnd,WindowId ) If hwnd1 != hwnd2 Goto SlowWindowFound EndIf ; Test by sequence. WindowSequence = 1 hwnd1 = cWndexist(hwnd, WindowSequence, BySeq) hwnd2 = cWndbyseq(hwnd, WindowSequence ) If hwnd1 != hwnd2 Goto SlowWindowFound EndIf Exit
cWndById, cWndByName, cWndBySeq, cWndByClass, DLLhwnd