[已解决]如果,检测不到配置文件中的第五项,如何禁用这第五项?
本帖最后由 K、Q 于 2011-1-24 14:30 编辑#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=CHK_D.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=WinXP & Win7
#AutoIt3Wrapper_Res_Description=KQ制作,判断D盘(系统部署使用).
#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=K丶Q 製作。
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ###
$Title = GUICreate("系统部署使用,判断D盘.",292,328,-1,-1)
$Ini = IniReadSection(@ScriptDir & "\CHK_D.ini","Setup")
GUISetFont(9,800,0,"微软雅黑")
$Icon1 = GUICtrlCreateIcon(@ScriptDir & "\CHK_D.ico", -0,11,25,32,32)
$Icon2 = GUICtrlCreateIcon(@ScriptDir & "\CHK_D.ico", -0,11,70,32,32)
$Icon3 = GUICtrlCreateIcon(@ScriptDir & "\CHK_D.ico", -0,11,115,32,32)
$Icon4 = GUICtrlCreateIcon(@ScriptDir & "\CHK_D.ico", -0,11,160,32,32)
$Icon5 = GUICtrlCreateIcon(@ScriptDir & "\CHK_D.ico", -0,11,205,32,32)
$Checkbox1 = GUICtrlCreateCheckbox("很抱歉,检测不到安装程序。",55,25,200,30,-1,$WS_EX_CLIENTEDGE)
$Checkbox2 = GUICtrlCreateCheckbox("很抱歉,检测不到安装程序。",55,70,200,30,-1,$WS_EX_CLIENTEDGE)
$Checkbox3 = GUICtrlCreateCheckbox("很抱歉,检测不到安装程序。",55,115,200,30,-1,$WS_EX_CLIENTEDGE)
$Checkbox4 = GUICtrlCreateCheckbox("很抱歉,检测不到安装程序。",55,160,200,30,-1,$WS_EX_CLIENTEDGE)
$Checkbox5 = GUICtrlCreateCheckbox("很抱歉,检测不到安装程序。",55,205,200,30,-1,$WS_EX_CLIENTEDGE)
;检测到安装程序.
GUICtrlSetData($Checkbox1,$Ini)
GUICtrlSetData($Checkbox2,$Ini)
GUICtrlSetData($Checkbox3,$Ini)
GUICtrlSetData($Checkbox4,$Ini)
GUICtrlSetData($Checkbox5,$Ini)
;检测到安装程序的状态.
GUICtrlSetState($Checkbox1,$GUI_CHECKED)
GUICtrlSetState($Checkbox2,$GUI_CHECKED)
GUICtrlSetState($Checkbox3,$GUI_CHECKED)
GUICtrlSetState($Checkbox4,$GUI_CHECKED)
GUICtrlSetState($Checkbox5,$GUI_CHECKED)
;检测不到安装成像鼓的状态.
GUICtrlSetState($Checkbox1,$GUI_DISABLE)
GUICtrlSetState($Checkbox2,$GUI_DISABLE)
GUICtrlSetState($Checkbox3,$GUI_DISABLE)
GUICtrlSetState($Checkbox4,$GUI_DISABLE)
GUICtrlSetState($Checkbox5,$GUI_DISABLE)
$Button1 = GUICtrlCreateButton("安装(&S)",82,264,127,30,$BS_DEFPUSHBUTTON)
Dim $Title_AccelTable = [["!S",$Button1]]
GUISetAccelerators($Title_AccelTable)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
我想要的效果图.
见第五个. 请看 GUICtrlSetState
例子:GUICtrlSetState(-1, $GUI_DISABLE) 感谢楼上的兄弟.
修改了下代码和配置文件
我加上检测代码后.
就提示“$Ini”出错.
配置文件如下:
1=QQ2010.exe
2=MyDoc.exe
3=test.cmd
4=test2.cmd
去掉第五行. 感觉用For循环写比较好 有点好看~~~~~~~~~~ 兄弟,我有个建议!
你可以直接读取配置文件再来写GUI,如果配置文件有六项的话就直接在GUI写出六项!这样子不是很好吗? 你可以参考一下我写的那个软件菜单!
源码你自己找一下吧! 你可以参考一下我写的那个软件菜单!
源码你自己找一下吧!
hzxymkb 发表于 2011-1-22 09:56 http://www.autoitx.com/images/common/back.gif
感谢超版的源码.
问题已经解决了.
修正后的代码如下.
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Title = GUICreate("判断D盘(部署环境下使用),v1.1.2011.01.", 411, 441, -1, -1)
$Ini = IniReadSectionNames(@ScriptDir & "\CHK_D.ini")
For $i = 1 To $Ini
$Checkbox = GUICtrlCreateCheckbox($Ini[$i], 120, ($i)*50+20, 220, 48, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$Icon = GUICtrlCreateIcon("D:\KQ\ES3\CHK_D\CHK_D.ico", -1, 60, ($i)*50+20, 48, 48)
GUICtrlSetFont($Checkbox, 10, 800, 0, "微软雅黑")
GUICtrlSetColor($Checkbox, 0x000000)
GUICtrlSetState($Checkbox,$GUI_CHECKED)
Next
$StatusBar1 = _GUICtrlStatusBar_Create($Title)
_GUICtrlStatusBar_SetSimple($StatusBar1)
_GUICtrlStatusBar_SetText($StatusBar1, "系统:" & @OSVersion & "_" & @OSServicePack)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 25)
$Button1 = GUICtrlCreateButton("开始安装", 114, 355, 183, 31)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
Dim $Title_AccelTable = [["^q", $Button1]]
GUISetAccelerators($Title_AccelTable)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
页:
[1]