#include #include #include #include Global $g_hCombo Example() Func Example() Local $hGUI ; Create GUI $hGUI = GUICreate("(UDF) ComboBox Create", 400, 296) $g_hCombo = _GUICtrlComboBox_Create($hGUI, "", 2, 2, 396, 296) GUISetState(@SW_SHOW) ; Add files _GUICtrlComboBox_BeginUpdate($g_hCombo) _GUICtrlComboBox_AddDir($g_hCombo, "", $DDL_DRIVES, False) _GUICtrlComboBox_EndUpdate($g_hCombo) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $g_hCombo Switch $iCode Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed MsgBox(0,"","$CBN_CLOSEUP") Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box MsgBox(0,"","$CBN_DBLCLK") Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible MsgBox(0,"","$CBN_DROPDOWN") Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box MsgBox(0,"","$CBN_EDITCHANGE") Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box MsgBox(0,"","$CBN_SELCHANGE") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND