找回密码
 加入
搜索
查看: 1454|回复: 8

关于GuiGetMsg()得不到消息事件的问题

  [复制链接]
发表于 2010-6-9 11:14:19 | 显示全部楼层 |阅读模式
本帖最后由 piaoa_998 于 2010-6-9 13:33 编辑

用GuiGetMsg()来获得消息事件,判断不同的操作,代码如下:
$Folder = @DesktopDir & "\AutoIt_log"
IF FileExists($Folder) then DirRemove($Folder,1);delete folder
If Not FileExists($Folder)Then DirCreate($Folder);Create The Dir

$Form1 = GUICreate("Form1", 625, 443, 193, 125)
$Label1 = GUICtrlCreateLabel("TEST", 56, 16, 507, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Browse...", 512, 160, 57, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Combo3 = GUICtrlCreateCombo("", 208, 216, 281, 25)
$Button2 = GUICtrlCreateButton("Browse...", 504, 216, 81, 25, 0)
$Button3 = GUICtrlCreateButton("Start", 224, 296, 193, 41, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        select
                Case  $nMsg=$Button1
                        fileopendialog(..)
                Case  $nMsg=$Button2
                     fileopendialog(..)
            Case $nMsg=$Button3
                   Start()
            Case $nMsg=$GUI_EVENT_CLOSE
                   Exit
                EndSelect
               
WEnd
Func Start()
.....
EndFunc

选中button1,2,3 都不执行相应操作,是为什么呀?等各位指教
 楼主| 发表于 2010-6-9 11:18:34 | 显示全部楼层
本帖最后由 piaoa_998 于 2010-6-9 11:30 编辑

等着牛人们的回答
 楼主| 发表于 2010-6-9 11:28:05 | 显示全部楼层
,怎么没人解答呢。。。。
发表于 2010-6-9 12:01:52 | 显示全部楼层
有提示没有
发表于 2010-6-9 12:03:26 | 显示全部楼层
你的open参数都没写上,事件已经触发了的。
发表于 2010-6-9 12:05:12 | 显示全部楼层
自己保存下去测试看看吧:
$Folder = @DesktopDir & "\AutoIt_log"
IF FileExists($Folder) then DirRemove($Folder,1);delete folder
If Not FileExists($Folder)Then DirCreate($Folder);Create The Dir

$Form1 = GUICreate("Form1", 625, 443, 193, 125)
$Label1 = GUICtrlCreateLabel("TEST", 56, 16, 507, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Browse...", 512, 160, 57, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Combo3 = GUICtrlCreateCombo("", 208, 216, 281, 25)
$Button2 = GUICtrlCreateButton("Browse...", 504, 216, 81, 25, 0)
$Button3 = GUICtrlCreateButton("Start", 224, 296, 193, 41, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        select
                Case  $nMsg=$Button1
;                        fileopendialog(..)
msgbox(0,'','button1')
                Case  $nMsg=$Button2 
;                     fileopendialog(..)
msgbox(0,'','button2')
            Case $nMsg=$Button3
;                   Start()
msgbox(0,'','start')
            Case $nMsg=-3
                   Exit
                EndSelect
                
WEnd
Func Start()
.....
EndFunc
 楼主| 发表于 2010-6-9 13:30:52 | 显示全部楼层
fileopendialog那里我是省略了
不过现在问题暂时用另一种方法解决了,谢谢各位帮忙了
发表于 2010-6-10 16:14:48 | 显示全部楼层
为什么不用guictrlgetonevent???
发表于 2010-6-10 16:15:08 | 显示全部楼层
为什么不用guictrlsetonevent???
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-6 12:27 , Processed in 0.071518 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表