[已解决]大家看一看这个程序问题出在什么地方?
本帖最后由 风中柳 于 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 正常,设置的默认项就是1,每次读取的肯定的是1,又是无限循环其中间没有任何操作 本帖最后由 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 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 应该注意的Select,Switch的用法有何不同 回复 5# 3mile
听君一席话,胜读十年书!
页:
[1]