cSetWndSpecRetry

Sets number of retries performed by the cWndByWndSpec and cWndByWndSpecName functions.

Syntax:

cSetWndSpecRetry (retries)

Parameters:

(i) retries New retry attempts setting. Range 0 to 1000.

Returns:

(i) previous-retries Previous retry setting.

 

This function sets the number of times the cWndByWndSpec and cWndByWndSpecName functions attempt to find the window associated with the passed in window specification. The new setting affects all subsequent calls to the cWndByWndSpec and cWndByWndSpecName and remains in effect until the cSetWndSpecRetry function is called again or the extender is unloaded from memory.

While the function accepts a broad range of possible retries, it is recommended that the number of retires be set close to the default value of 20 to avoid excessive system resource usage.  Using a small number can be useful in instances where a window is not likely to exist and a timed loop is used to periodically check for the instance of a window.  

 

The following example periodically checks for the existence of a Notepad.exe window in a delayed loop.

 

Example:

AddExtender("wwctl44i.dll", 0 ,"wwctl64i.dll")
; Notepad main window specification.
sNotepadSpec = '"Notepad","notepad",2,15,1025'
; CwndByWndSpec will try twice and quit.
cSetWndSpecRetry(1)
; Wait indefinitely for Notepad.
While 1
   If cWndByWndSpec(%sNotepadSpec%) Then Break ; Found it
   TimeDelay(5)
EndWhile
Message("Success", "Found Notepad window")

See Also:

cWndByWndSpec, cWndByWndSpecName