软件安装管理器的这个效果是如何作出来的
请问各位朋友:下图中的“软件安装管理器”的这个效果是如何作出来的说明:运行该软件后,主程序隐藏,右下角出现了该图片。最好给个列子,本人是菜鸟。
子窗口调到右下角
#include <WindowsConstants.au3>
$Form2 = GUICreate("右下角", 285, 40, @DesktopWidth-300, @DesktopHeight-80,BitOR($WS_POPUP, $WS_CLIPSIBLINGS))
$Btn1 = GUICtrlCreateButton("", 5, 12, 22, 22, 0x40)
GUICtrlSetImage(-1, "1.ico")
$pro1 = GUICtrlCreateProgress(50, 15, 230, 16)
GUISetState(@SW_SHOW)
While 1
Sleep(2)
WEnd 谢谢指教,能加个小边框吗? 回复 3# dnvplj
高度为 1 的文本标签作水平线, 宽度为 1 的文本标签作垂直线 元老也出手了,很感动,边框怎么做能说细点吗?别外,怎么调用“软件管理器”指定的图标。最好有个例子。 {:face (327):} 回复 5# dnvplj
怎么调用“软件管理器”指定的图标。最好有个例子。可以使用配置文件.ini嘛 本帖最后由 dnvplj 于 2014-6-2 08:12 编辑
最好是主程序调用,但不知道怎么写到“软件管理器里“,下面是本论坛的代码,请问:应写到那个位置。原代码作者:crwmart#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=ico\2.ICO
#AutoIt3Wrapper_outfile=E:\软件安装\soft.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Soft_2.0
#AutoIt3Wrapper_Res_Description=软件安装管理器
#AutoIt3Wrapper_Res_Fileversion=2.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=版权所有crwmart(C) 2008
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <StaticConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
;检查配置文件
If FileExists(@ScriptDir & "\soft\soft.ini") = 0 Then
MsgBox(64 + 0, "错误", @ScriptDir & "\soft 下缺少soft.ini配置文件!")
Exit
EndIf
Opt("TrayOnEventMode", 1)
Opt("guicloseonesc", 0)
Dim $soft, $radio, $softR, $softN, $softE
Dim $Title = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "软件标题", "")
Dim $LOGO = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "LOGO图片", "")
Dim $OEM = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "软件OEM", "")
Dim $len = StringLen($OEM)
$len = $len * 12
Dim $Path1 = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "安装路径", "")
If StringRight($Path1, 1) = "\" Then
Dim $Path = StringTrimRight($Path1, 1)
Else
Dim $Path = $Path1
EndIf
Dim $choose1 = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "常用软件", "")
Dim $choose2 = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "可选软件", "")
Dim $Kill = IniRead(@ScriptDir & "\soft\soft.ini", "设置", "自我删除", "")
For $i = 0 To 9
$softN[$i] = IniRead(@ScriptDir & "\soft\soft.ini", $i, "软件名称", "")
$softE[$i] = IniRead(@ScriptDir & "\soft\soft.ini", $i, "文件名", "")
$softR[$i] = IniRead(@ScriptDir & "\soft\soft.ini", $i, "软件介绍", "")
Next
;创建窗体
$Form1 = GUICreate($Title, 440, 342, -1, -1)
$Pic1 = GUICtrlCreatePic($LOGO, 0, 0, 440, 70)
$Label5 = GUICtrlCreateLabel($OEM, 350 - $len, 52, $len, 16)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor($Label5, $GUI_BKCOLOR_TRANSPARENT)
$Group1 = GUICtrlCreateGroup("常用软件", 10, 75, 300, 80)
$Group2 = GUICtrlCreateGroup("可选软件", 10, 160, 300, 60)
$soft = GUICtrlCreateCheckbox("&1 " & $softN, 20, 90, 140, 20)
$soft = GUICtrlCreateCheckbox("&2 " & $softN, 20, 110, 140, 20)
$soft = GUICtrlCreateCheckbox("&3 " & $softN, 20, 130, 140, 20)
$soft = GUICtrlCreateCheckbox("&7 " & $softN, 20, 175, 140, 20)
$soft = GUICtrlCreateCheckbox("&8 " & $softN, 20, 195, 140, 20)
$soft = GUICtrlCreateCheckbox("&4 " & $softN, 165, 90, 140, 20)
$soft = GUICtrlCreateCheckbox("&5 " & $softN, 165, 110, 140, 20)
$soft = GUICtrlCreateCheckbox("&6 " & $softN, 165, 130, 140, 20)
$soft = GUICtrlCreateCheckbox("&9 " & $softN, 165, 175, 140, 20)
$soft = GUICtrlCreateCheckbox("&0 " & $softN, 165, 195, 140, 20)
For $i = 0 To 9
GUICtrlSetState($soft[$i], $GUI_DISABLE)
Next
$Group4 = GUICtrlCreateGroup("安装方式", 320, 75, 110, 145)
$radio = GUICtrlCreateRadio("选择全部(&A)", 335, 100, 80, 20)
$radio = GUICtrlCreateRadio("全部清空(&B)", 335, 130, 80, 20)
$radio = GUICtrlCreateRadio("常用软件(&C)", 335, 160, 80, 20)
GUICtrlSetState($radio, $GUI_CHECKED)
choose1()
$radio = GUICtrlCreateRadio("可选软件(&D)", 335, 190, 80, 20)
For $i = 1 To 4
GUICtrlSetState($radio[$i], $GUI_DISABLE)
Next
$Group3 = GUICtrlCreateGroup("软件详细信息:", 10, 225, 235, 60)
$Label3 = GUICtrlCreateLabel("www", 25, 247, 215, 32)
GUICtrlSetState($Label3, $GUI_DISABLE)
$input1 = GUICtrlCreateInput($Path, 258, 233, 170, 18)
GUICtrlSetState($input1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("点击选择软件安装路径 (&F)", 258, 260, 170, 23)
GUICtrlSetState($Button1, $GUI_DISABLE)
$Label4 = GUICtrlCreateLabel("", 300, 327, 140, 20, $WS_EX_STATICEDGE)
$Progress1 = GUICtrlCreateProgress(10, 293, 235, 18)
$Button2 = GUICtrlCreateButton("手动选择(&S)", 258, 291, 80, 22)
$Button3 = GUICtrlCreateButton("开始安装(&Y)", 348, 291, 80, 22)
$Graphic1 = GUICtrlCreateGraphic(0, 322, 443, 2, $SS_ETCHEDHORZ)
$Graphic2 = GUICtrlCreateGraphic(290, 326, 2, 17, BitOR($SS_CENTER, $SS_ETCHEDHORZ))
$Graphic3 = GUICtrlCreateGraphic(103, 326, 2, 17, BitOR($SS_CENTER, $SS_ETCHEDHORZ))
$Label1 = GUICtrlCreateLabel(@YEAR & "年" & @MON & "月" & @MDAY & "日", 10, 327, 90, 20)
$Label2 = GUICtrlCreateLabel("技术支持:crwmart", 113, 327, 170, 16)
GUICtrlSetState($Label1, $GUI_DISABLE)
GUICtrlSetState($Label2, $GUI_DISABLE)
GUISetState(@SW_SHOW)
;定义热键
HotKeySet("{ESC}", "Close")
;倒计时设置
AdlibEnable("pro1", 200)
$wait = 0
Func pro1()
GUICtrlSetData($Progress1, $wait)
For $v = 0 To 20 Step 1
If GUICtrlRead($Progress1) = $v * 5 Then GUICtrlSetData($Label4, 20 - $v & "秒后自动安装所选项目")
Next
$wait = $wait + 1
If $wait > 100 Then runsoft()
EndFunc ;==>pro1
;以下为获取窗口事件
While 1
$nMsg = GUIGetMsg()
GetPos()
Select
Case $nMsg = $GUI_EVENT_CLOSE
AdlibDisable()
If $Kill = 1 Then
FileDelete($LOGO)
DirRemove(@ScriptDir & "\soft", 1)
Run(@ComSpec & " /c ping -n 3 127.1>nul & del /q soft.exe", @ScriptDir, @SW_HIDE)
EndIf
ExitLoop
Case $nMsg = $radio
all()
Case $nMsg = $radio
none()
Case $nMsg = $radio
choose1()
Case $nMsg = $radio
choose2()
Case $nMsg = $Button1
Folder()
Case $nMsg = $Button2
selecte()
Case $nMsg = $Button3
runsoft()
EndSelect
WEnd
;选择全部
Func all()
AdlibDisable()
For $i = 0 To 9
GUICtrlSetState($soft[$i], $GUI_CHECKED)
Next
EndFunc ;==>all
;清空所有
Func none()
AdlibDisable()
For $i = 0 To 9
GUICtrlSetState($soft[$i], $GUI_UNCHECKED)
Next
EndFunc ;==>none
;常用软件安装
Func choose1()
AdlibDisable()
none()
For $i = 0 To 9
If StringInStr($choose1, $i) Then
GUICtrlSetState($soft[$i], $GUI_CHECKED)
EndIf
Next
EndFunc ;==>choose1
;可选软件安装
Func choose2()
AdlibDisable()
none()
For $i = 0 To 9
If StringInStr($choose2, $i) Then
GUICtrlSetState($soft[$i], $GUI_CHECKED)
EndIf
Next
EndFunc ;==>choose2
;设置安装目录
Func Folder()
AdlibDisable()
$Path = FileSelectFolder("选择安装目录", "")
GUICtrlSetData($input1, $Path)
EndFunc ;==>Folder
;进行手动选择
Func selecte()
AdlibDisable()
GUICtrlSetData($Label4, "正在进行手动选择...")
For $i = 0 To 9
GUICtrlSetState($soft[$i], $GUI_ENABLE)
Next
GUICtrlSetState($input1, $GUI_ENABLE)
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetState($radio, $GUI_ENABLE)
GUICtrlSetState($radio, $GUI_ENABLE)
GUICtrlSetState($radio, $GUI_ENABLE)
GUICtrlSetState($radio, $GUI_ENABLE)
GUICtrlSetState($Label3, $GUI_ENABLE)
EndFunc ;==>selecte
;安装所选项目,请自行命名0-9软件名称,支持rar/exe/7z
Func runsoft()
$InstallPath = GUICtrlRead($input1)
AdlibDisable()
GUICtrlSetData($Label4, "正在进行软件安装...")
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Button3, $GUI_DISABLE)
For $i = 0 To 9
If GUICtrlRead($soft[$i]) = $GUI_CHECKED Then
If StringInStr($softE[$i], ".7z") Then
SplashTextOn("", "" & @CRLF & "正在安装在安装" & $softN[$i], 200, 38, @DesktopWidth - 230, @DesktopHeight - 80, 1, "", 10)
RunWait("soft\7za.exe " & "x " & @ScriptDir & "\soft\" & $softE[$i] & " -y -o" & '"' & $InstallPath & '"', @ScriptDir, @SW_HIDE)
ElseIf StringInStr($softE[$i], ".rar") Then
SplashTextOn("", "" & @CRLF & "正在安装在安装" & $softN[$i], 200, 38, @DesktopWidth - 230, @DesktopHeight - 80, 1, "", 10)
RunWait("soft\unrar.exe x -y -o+ " & @ScriptDir & "\soft\" & $softE[$i] & " " & '"' & $InstallPath & "\" & '"', @ScriptDir, @SW_HIDE)
Else
RunWait(@ScriptDir & "\soft\" & $softE[$i] & " -y -o" & '"' & $InstallPath & '"')
EndIf
EndIf
Next
SplashOff()
If $Kill = 1 Then
FileDelete($LOGO)
DirRemove(@ScriptDir & "\soft", 1)
Run(@ComSpec & " /c ping -n 3 127.1>nul & del /q soft.exe", @ScriptDir, @SW_HIDE)
EndIf
Exit
EndFunc ;==>runsoft
;ESC热键设置
Func Close()
If $Kill = 1 Then
FileDelete($LOGO)
DirRemove(@ScriptDir & "\soft", 1)
Run(@ComSpec & " /c ping -n 3 127.1>nul & del /q soft.exe", @ScriptDir, @SW_HIDE)
EndIf
Exit
EndFunc ;==>Close
;对应按钮说明设置
Func GetPos()
Local $a
Local $x1 = " " & $softR
Local $x2 = " " & $softR
Local $x3 = " " & $softR
Local $x4 = " " & $softR
Local $x5 = " " & $softR
Local $x6 = " " & $softR
Local $x7 = " " & $softR
Local $x8 = " " & $softR
Local $x9 = " " & $softR
Local $x0 = " " & $softR
$x = GUICtrlRead($Label3)
$a = GUIGetCursorInfo($Form1)
If $a = 7 And $x <> $x1 Then
GUICtrlSetData($Label3, $x1)
ElseIf $a = 8 And $x <> $x2 Then
GUICtrlSetData($Label3, $x2)
ElseIf $a = 9 And $x <> $x3 Then
GUICtrlSetData($Label3, $x3)
ElseIf $a = 12 And $x <> $x4 Then
GUICtrlSetData($Label3, $x4)
ElseIf $a = 13 And $x <> $x5 Then
GUICtrlSetData($Label3, $x5)
ElseIf $a = 14 And $x <> $x6 Then
GUICtrlSetData($Label3, $x6)
ElseIf $a = 10 And $x <> $x7 Then
GUICtrlSetData($Label3, $x7)
ElseIf $a = 11 And $x <> $x8 Then
GUICtrlSetData($Label3, $x8)
ElseIf $a = 15 And $x <> $x9 Then
GUICtrlSetData($Label3, $x9)
ElseIf $a = 16 And $x <> $x0 Then
GUICtrlSetData($Label3, $x0)
EndIf
EndFunc ;==>GetPos
程序写得这么复杂了 定义好这个窗口,随便写在哪个位置。然后安装的时候去用
页:
[1]