#Include <GUIConstants.au3>
#Include <StaticConstants.au3>
#Include <GuiListBox.au3>
#Include <GUIComboBox.au3>
GUICreate("hello",200,100)
$Combo=GUICtrlCreateCombo("",10,10,160,20)
GUICtrlSetData($Combo,"item1|item2|item3")
guisetstate()
GUIRegisterMsg(0x0111,"WM_COMMAND")
While 1
Sleep(50)
if GUIGetMsg()=$GUI_EVENT_CLOSE Then Exit
WEnd
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
Local $IdFrom, $iCode
$IdFrom = BitAnd($wParam, 0x0000FFFF)
$iCode = BitShift($wParam, 16)
Switch $iCode
Case 1
Switch $IdFrom
Case $Combo
$thesel=_GUICtrlComboBox_GetCurSel($Combo)
If $thesel=0 Then
MsgBox(0,"","选择了第一个哦")
ElseIf $thesel=1 Then
MsgBox(0,"","选择了第二个哦")
ElseIf $thesel=2 Then
MsgBox(0,"","选择了第三个哦")
EndIf
EndSwitch
EndSwitch
endfunc
|