wjscxs 发表于 2010-6-9 18:03:23

如何通过$WM_COMMAND把combox 选择后的值赋值给某变量

本帖最后由 wjscxs 于 2010-6-11 17:53 编辑

#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIComboBox.au3>
#Region ### START Koda GUI section ### Form=
$Form = GUICreate("", 441, 278, @DesktopWidth-460, -5)
$nian = _GUICtrlComboBox_Create($Form,"", 63, 7, 48, 25)
_GUICtrlComboBox_BeginUpdate($nian)
for $i =0 to 148
        _GUICtrlComboBox_AddString($nian,$i+1901)
Next
_GUICtrlComboBox_SetEditText($nian,@YEAR)
_GUICtrlComboBox_EndUpdate($nian)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUIRegisterMsg($WM_COMMAND,"combo_edit")
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
func combo_edit($hWnd, $iMsg, $iwParam, $ilParam)
        #forceref $hWnd, $iMsg
        Local$hWndFrom,$iCode
        $hWndFrom = $ilParam
        ;$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
        $iCode = BitShift($iwParam, 16) ; Hi Word
        Switch $hWndFrom
                Case $nian
                        Switch $iCode
                                Case $CBN_SELCHANGE
                                        MsgBox(1,"",_GUICtrlComboBox_GetEditText($nian))
                        EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND看到没,那个msgbox(MsgBox(1,"",_GUICtrlComboBox_GetEditText($nian)))有没办法让它显示combo选择后的值,(不是选择前的值)

wjscxs 发表于 2010-6-11 20:06:12

bump,,,,,,,

pusofalse 发表于 2010-6-11 20:17:21

Local $sText, $iCurSel

Switch $iCode
Case $CBN_SELENDOK
        $iCurSel = _GUICtrlComboBox_GetCurSel($nian)
        _GUICtrlComboBox_GetLBText($nian, $iCurSel, $sText)
        MsgBox(1,"", $sText)
EndSwitch

wjscxs 发表于 2010-6-12 07:39:28

谢谢......{:face (396):}
页: [1]
查看完整版本: 如何通过$WM_COMMAND把combox 选择后的值赋值给某变量