cSetWndText

Change the text associated with a Windows control.

Syntax:

cSetWndText(window-handle, text)

Parameters:

(i) window-handle Window handle of a control.

(s) text New text to be associated with control

Returns:

(i) @FALSE; Always returns 0

 

You can use cSetWndText to change the text associated with a Windows control. The text changed by this function depends on the type of control you target. For windows with a title bar, the text in the title bar is changed to the new string. On the other hand, Edit controls have the text in the edit box changed, unless they have the WS_CAPTION style, then the caption is changed. Combo boxes have the text in the edit control part changed. Button controls have the text displayed on the button changed.

 

cSetWndText will error, if the input window handle does not reference an existing window or control.

When cSetWndText is applied to a top-level (parent) window, it is similar to the WIL function WinTitle. See Windows Interface Language documentation for more information on the WinTitle function.

 

Warning: Some applications may rely upon their window’s and control’s title staying the same! Therefore, like all control manager functions, the cSetWndText function should be used with caution.

 

Example:

AddExtender("wwctl44i.dll",0,"wwctl64i.dll")
; Launch the save as dialog (assumes Notepad is running)
SendMenusTo("~Notepad", "File Open")
WinWaitExist("Open", 8)
; Get a button control's handle
hwnd = DllHwnd("Open")
hwndCtl = cWndbyname(hwnd, "Cancel")
; Change the buttons text.
sChange = "Quit"
cSetWndText(hwndCtl, sChange)
;Make sure it actually changed.
sNew =  cWndinfo(hwndCtl, 0)
If StrCmp(sNew, sChange) != 0
   Goto errorhandler
EndIf
Exit

See Also:

cWndinfo