cGetCBSelText

Obtain the selected item  from a drop-down combo box. 

Syntax:

cGetCBSelText( hwnd )

Parameters:

(i) hwnd ComboBox handle from a cWndBy... function.

Returns:

(s) selected-text: the text currently displayed in the upper portion of the control

 

This function is used to obtain the selected item of a Combo Box control. The selected item is the item displayed in the upper portion of the control and unlike other controls the selected item may not always have the system selection color as the item’s background color. The returned string contains the text of the selected item or an empty string, if no item is selected.  

The function may error or return an unexpected result, if the combo box has the owner-drawn style; is not based on a Windows operating system window class; or is a sub-classed control.

Example:
AddExtender("wwctl44i.dll",0,"wwctl64i.dll")
;The following example retrieves the name of the current Windows XP desktop
sWindowName = "~Display Properties"
; Launch desktop control panel applet.
ShellExecute(DirWindows(1):"desk.cpl", "", "", @NORMAL, "")
If !WinWaitExist(sWindowName, 10) Then Exit
; Get the Theme name combobox.
hWnd = DllHwnd(sWindowName)
hWnd = cWndbyname( hWnd, "~Themes" )
hWnd = cWndbyclass( hWnd,"ComboBox")
; Get the current selected them.
sSelected = cGetCBSelText(hWnd)
Message("Current Theme", sSelected)
WinClose(sWindowName)
Exit
See Also:

cSetCBItem, cGetCBText, cGetCBCount