找回密码
 加入
搜索
查看: 1741|回复: 5

[AU3基础] [已解决]大家看一看这个程序问题出在什么地方?

  [复制链接]
发表于 2011-4-29 01:13:42 | 显示全部楼层 |阅读模式
本帖最后由 风中柳 于 2011-4-29 09:42 编辑

在列表框选择“1”后总是一直不停打开程序,没有办法关闭!不会结束!怎么修改才能解决?
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <GuiComboBoxEx.au3>
#include <TabConstants.au3>
#include <GUITab.au3>
#include <ListviewConstants.au3>
#Include <GuiListView.au3>
#include <ListBoxConstants.au3>
#include <Process.au3>
#include <GuiListView.au3>
#include <Constants.au3>
Opt('MustDeclareVars', 0 )
$Form1=GUICreate("常用小工具",360,300) ; 创建一个居中显示的 GUI 窗口
$tabCombo1 = GUICtrlCreateCombo("外部程序", 20, 250, 80, 20, $CBS_DROPDOWNLIST)
            GUICtrlSetData($tabCombo1, "1|2", "item1")
        GUISetState(@SW_SHOW, $Form1); 显示一个空白的窗口
While 1
                $msg = GUIGetMsg()
                Select
                        Case $msg = $GUI_EVENT_CLOSE
                                ExitLoop
                        Case $tabCombo1
         If GUICtrlRead($tabCombo1) = "1" Then
        ShellExecute("mstsc.exe", "", "", "open", @SW_MAXIMIZE)
EndIf       
                EndSelect
        WEnd
发表于 2011-4-29 02:51:14 | 显示全部楼层
正常,设置的默认项就是1,每次读取的肯定的是1,又是无限循环其中间没有任何操作
发表于 2011-4-29 06:42:35 | 显示全部楼层
本帖最后由 netegg 于 2011-4-29 06:44 编辑

回复 3# 风中柳
Example()

Func Example()
        Local $msg
        GUICreate("My GUI combo")  ; will create a dialog box that when displayed is centered

        Local $tabCombo1 = GUICtrlCreateCombo("item1", 10, 10) ; create first item
        GUICtrlSetData(-1, "item2|item3", "item3") ; add other item snd set a new default

        GUISetState()

        ; Run the GUI until the dialog is closed
        While 1
                $msg = GUIGetMsg()
               
                If $msg = $GUI_EVENT_CLOSE Then ExitLoop
                If $msg= $tabCombo1 Then
                      MsgBox(0,0,GUICtrlRead($tabCombo1))
                EndIf      

        WEnd
EndFunc   ;==>Example
 楼主| 发表于 2011-4-29 07:54:13 | 显示全部楼层
本帖最后由 风中柳 于 2011-4-29 09:21 编辑

回复 4# netegg
实在是愚钝 问题解决!谢谢!
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <GuiComboBoxEx.au3>
#include <TabConstants.au3>
#include <GUITab.au3>
#include <ListviewConstants.au3>
#Include <GuiListView.au3>
#include <ListBoxConstants.au3>
#include <Process.au3>
#include <GuiListView.au3>
#include <Constants.au3>
Opt('MustDeclareVars', 0 )
$Form1=GUICreate("常用小工具",360,300) ; 创建一个居中显示的 GUI 窗口
$tabCombo1 = GUICtrlCreateCombo("外部程序", 20, 250, 80, 20, $CBS_DROPDOWNLIST)
            GUICtrlSetData($tabCombo1, "1|2", "item1")
        GUISetState(@SW_SHOW, $Form1); 显示一个空白的窗口
While 1
                $msg = GUIGetMsg()
                Select
                        Case $msg = $GUI_EVENT_CLOSE
                                ExitLoop
                        Case $msg =$tabCombo1  问题出在这个地方没有$msg =
         If GUICtrlRead($tabCombo1) = "1" Then
        ShellExecute("mstsc.exe", "", "", "open", @SW_MAXIMIZE)
EndIf        
                EndSelect
        WEnd
发表于 2011-4-29 09:35:17 | 显示全部楼层
应该注意的Select,Switch的用法有何不同
 楼主| 发表于 2011-4-29 09:41:42 | 显示全部楼层
回复 5# 3mile


    听君一席话,胜读十年书!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-2 06:32 , Processed in 0.269300 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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