wegen Combobox mal eine kleine frage

  • Hi leute wie mache ich das wenn ich die Combobox drücke auch die meldung kommt mit den Ländern.
    Will nicht immer den Button drücken um die meldung zu erhalten.
    Habe zwar ein Beispiel mit Login gesehn hier im Forum aber da blicke ich nicht ganz durch.
    Werde auch noch weiter probieren mal sehn ob ich es schaffe aber bis jetzt schaffe ich es nicht.


    Spoiler anzeigen
    [autoit]


    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.6.1
    Author: myName

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Script Start - Add your code below here

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <GuiComboBoxEx.au3>
    #include <GuiImageList.au3>
    #include <GuiListView.au3>
    #include <inet.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Dim $INI[1]
    $INI[0] = @ScriptDir & "\data\icon.dll"

    [/autoit] [autoit][/autoit] [autoit]

    Local $StartLang = 'Deutsch',$aLanguage, $iLanguage
    $Lang = "Germany|Englisch|Schwedische|Switzerland|France|Italienisch";
    $aLanguage = StringSplit($Lang, '|')
    For $i = 1 To $aLanguage[0]
    If $StartLang = $aLanguage[$i] Then $iLanguage = $i - 1
    Next

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Test = GUICreate("Test", 368, 110, 192, 124)
    $Combo1 = _GUICtrlComboBoxEx_Create($Test,"", 8, 40, 265, 25, $CBS_DROPDOWNLIST)
    If FileExists($INI[0]) Then
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, $INI[0], 1, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 5, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 4, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 3, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 0, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 2, True)
    _GUICtrlComboBoxEx_SetImageList($Combo1, $hImage)
    EndIf
    _GUICtrlComboBoxEx_SetItemHeight($Combo1, 0, 25)
    For $i = 1 To $aLanguage[0]
    _GUICtrlComboBoxEx_AddString($Combo1, $aLanguage[$i], $i-1, $i-1)
    Next
    _GUICtrlComboBoxEx_SetCurSel($Combo1, $iLanguage)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Button1 = GUICtrlCreateButton("Button1", 280, 40, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    #cs
    If Not _GUICtrlComboBoxEx_GetDroppedState($Combo1) Then
    If _GUICtrlComboBoxEx_GetCurSel($Combo1) <> $iLanguage Then
    $iLanguage = _GUICtrlComboBoxEx_GetCurSel($Combo1)

    EndIf
    EndIf
    #ce

    Case $Button1
    $Laender = _GUICtrlComboBoxEx_GetCurSel($Combo1)
    _GUICtrlComboBoxEx_GetItemText($Combo1,$Laender,$Laender)
    MsgBox (0, "", $Laender)
    EndSwitch

    WEnd

    [/autoit]
    • Offizieller Beitrag
    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.6.1
    Author: myName

    Script Function:
    Template AutoIt script.

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Script Start - Add your code below here
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <GuiComboBoxEx.au3>
    #include <GuiImageList.au3>
    #include <GuiListView.au3>
    #include <inet.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Dim $INI[1]
    $INI[0] = @ScriptDir & "\icon.dll"

    [/autoit] [autoit][/autoit] [autoit]

    Local $StartLang = 'Deutsch', $aLanguage, $iLanguage
    $Lang = "Germany|Englisch|Schwedische|Switzerland|France|Italienisch";
    $aLanguage = StringSplit($Lang, '|')
    For $i = 1 To $aLanguage[0]
    If $StartLang = $aLanguage[$i] Then $iLanguage = $i - 1
    Next

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Test = GUICreate("Test", 368, 110, 192, 124)
    $Combo1 = _GUICtrlComboBoxEx_Create($Test, "", 8, 40, 265, 100, $CBS_DROPDOWNLIST)
    If FileExists($INI[0]) Then
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, $INI[0], 1, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 5, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 4, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 3, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 0, True)
    _GUIImageList_AddIcon($hImage, $INI[0], 2, True)
    _GUICtrlComboBoxEx_SetImageList($Combo1, $hImage)
    EndIf
    _GUICtrlComboBoxEx_SetItemHeight($Combo1, 0, 25)
    For $i = 1 To $aLanguage[0]
    _GUICtrlComboBoxEx_AddString($Combo1, $aLanguage[$i], $i - 1, $i - 1)
    Next
    _GUICtrlComboBoxEx_SetCurSel($Combo1, $iLanguage)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Button1 = GUICtrlCreateButton("Button1", 280, 40, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    #cs
    If Not _GUICtrlComboBoxEx_GetDroppedState($Combo1) Then
    If _GUICtrlComboBoxEx_GetCurSel($Combo1) <> $iLanguage Then
    $iLanguage = _GUICtrlComboBoxEx_GetCurSel($Combo1)

    EndIf
    EndIf
    #ce

    [/autoit] [autoit][/autoit] [autoit]

    Case $Button1
    $Laender = _GUICtrlComboBoxEx_GetCurSel($Combo1)
    _GUICtrlComboBoxEx_GetItemText($Combo1, $Laender, $Laender)
    MsgBox(0, "", $Laender)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    WEnd
    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    Switch $hWndFrom
    Case $Combo1
    Switch $iCode

    [/autoit] [autoit][/autoit] [autoit]

    Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box
    $Laender = _GUICtrlComboBoxEx_GetCurSel($Combo1)
    _GUICtrlComboBoxEx_GetItemText($Combo1, $Laender, $Laender)
    MsgBox(0, "", $Laender)
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    Die MsgBox sollte aber aus der WM_COMMAND verschwinden, Sie dient nur zum Test.