|
本帖最后由 republican 于 2010-8-10 09:07 编辑
代码如下:#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Opt("ExpandVarStrings", 1)
Example()
;-------------------------------------------------------------------------------------
; Example - Press the button to see the value of the radio boxes
; The script also detects state changes (closed/minimized/timeouts, etc).
Func Example()
Local $button_1, $group_1, $radio_1, $radio_2, $radio_3
Local $radioval1, $radioval2, $msg,$Formtest,$labe1
Opt("GUICoordMode", 1)
$Formtest = GUICreate("Radio Box Demo", 400, 280)
$button_1 = GUICtrlCreateButton("B&utton 1", 30, 20, 120, 40)
$labe1= GUICtrlCreateList($button_1,100,70,200,1000)
GUISetState()
While 1
$msg = GUIGetMsg(1)
If $msg[0] <> 0 And $msg[1] = $Formtest Then ;
GUICtrlSetData($labe1,$msg[2])
Sleep(50)
Select
Case $msg[1] = $Formtest
Case $msg[2] = $GUI_EVENT_CLOSE
MsgBox(0, "", "Dialog was closed")
Exit
Case $msg[2] = $GUI_EVENT_MINIMIZE
MsgBox(0, "", "Dialog minimized", 2)
Case $msg[2] = $GUI_EVENT_MAXIMIZE
MsgBox(0, "", "Dialog restored", 2)
Case $msg[2] = $button_1
MsgBox(0, "Default button clicked", "Radio " & $radioval1)
EndSelect
EndIf
WEnd
;~ While 1
;~ $msg = GUIGetMsg()
;~ GUICtrlSetData($labe1,$msg&'" '&$button_1);&'" '&$msg[2])
;~ Select
;~ Case $msg = $GUI_EVENT_CLOSE
;~ MsgBox(0, "", "Dialog was closed")
;~ Exit
;~ Case $msg = $GUI_EVENT_MINIMIZE
;~ MsgBox(0, "", "Dialog minimized", 2)
;~ Case $msg = $GUI_EVENT_MAXIMIZE
;~ MsgBox(0, "", "Dialog restored", 2)
;~ Case $msg = $button_1
;~ MsgBox(0, "Default button clicked", "Radio " & $radioval1)
;~ Case $msg >= $radio_1 And $msg <= $radio_3
;~ $radioval1 = $msg - $radio_1
;~ EndSelect
;~ WEnd
EndFunc ;==>Example
注释掉的为原来的正常代码。
3为控件ID,然而GetMsg获得却是不知道什么进制的数(窗口ID能正确获取,0X00000000,应该为没发生任何事的情况),遂请问各位,
如何能在高级模式中使代码正常运行?
PS:搜官方网站以前貌似有个Opt("GUIEventAdvancedMode", 1)参数,现在没了,不知道是不是官方放弃了支持? |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|