Here is a one way to deal with some combobox events:
#include <GuiConstants.au3> Global Const $WM_COMMAND = 0x0111 $Gui = GuiCreate("ComboBox Handler Example") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") $ComboBox = GUICtrlCreateCombo("", 20, 80) GUICtrlSetData(-1, "Some text|More text|another text") ;Just for checking the combo focus GUICtrlCreateInput("", 20, 120) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit EndSwitch WEnd Func WM_COMMAND($hWndGUI, $MsgID, $WParam, $LParam) If Not BitAND(WinGetState($hWndGUI), 2) Then Return $GUI_RUNDEFMSG Local $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word Local $iCode = BitShift($wParam, 16) ; Hi Word Switch $iIDFrom Case $ComboBox Switch $iCode Case 1 Local $sComboData = GUICtrlRead($iIDFrom) Local $sComboIndex = ControlCommand($hWndGUI, "", $iIDFrom, "FindString", $sComboData) PrintF("ComboBox selected: [Index = " & $sComboIndex & "], Text = " & $sComboData) Case 3 PrintF("ComboBox has focus") Case 4 PrintF("ComboBox lost focus") Case 5, 6 PrintF("ComboBox changed/updated: " & GUICtrlRead($iIDFrom)) Case 7 PrintF("ComboBox is Opened") Case 8 PrintF("ComboBox is Closed") Case Else PrintF($iCode) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func PrintF($sStr, $Line=@ScriptLineNumber) ConsoleWrite(@LF & "+======================================================" & @LF & _ "--> Script Line (" & $Line & "):" & @LF & "!" & @TAB & $sStr & @LF & _ "+======================================================") EndFunc






