#Include <APIConstants.au3>
#include <AVIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#Include <WinAPI.au3>
#Include <WinAPIEx.au3>
#include <WindowsConstants.au3>
;检测文件是否存在及大小
Local $Size = InetGetSize("http://cdn05.foxitsoftware.com/pub/foxit/phantomPDF/desktop/win/5.x/5.0/chs/FoxitPhantomPDF504_Business_chs_Setup.msi")
;注意网址字符串的截取方式
If $Size = 0 Then
MsgBox(0+64,"无法找到该文件","最可能的原因是:" & @CRLF & " ·在地址中可能存在键入错误。" & @CRLF & " ·当您点击某个链接时,它可能已过期。")
Exit
EndIf
;截取各部分字符串,如:cdn05.foxitsoftware.com、FoxitPhantomPDF504_Business_chs_Setup.msi
$WinSub = GUICreate("文件下载 - 安全警告",398,224,-1,-1,BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_DLGMODALFRAME)
;创建标题栏无 图标、最小化、最大化
_WinAPI_DestroyIcon(_WinAPI_GetClassLongEx($WinSub,$GCL_HICON))
_WinAPI_SetClassLongEx($WinSub,$GCL_HICON, 0)
_WinAPI_SetClassLongEx($WinSub,$GCL_HICONSM, 0)
GUICtrlCreateLabel("您想运行或保存此文件吗?",15,15,368)
GUICtrlSetFont (-1,9,800)
;检测下载文件的类型
;.exe - 应用程序 - shell32.dll - 3
;.msi - Windows Installer 软件包 - msiexec.exe - 1
;.
;.
;.
$CreateIcon = GUICtrlCreateIcon("msiexec.exe",1,15,45)
GUICtrlCreateLabel("名称:",83,45,45)
GUICtrlCreateLabel("FoxitPhantomPDF504_Business_chs_Setup.msi",122,45,261)
GUICtrlCreateLabel("类型:",83,63,45)
GUICtrlCreateLabel("Windows Installer 软件包, " & "241" & "MB",122,63,261)
GUICtrlCreateLabel(" 从:",83,81,45)
GUICtrlCreateLabel("cdn05.foxitsoftware.com",122,81,261)
GUICtrlSetFont (-1,9,800)
$Button11 = GUICtrlCreateButton("运行(&R)",131,113,78,21)
$Button12 = GUICtrlCreateButton("保存(&S)",216,113,78,21)
$Button13 = GUICtrlCreateButton("取消",302,113,78,21)
GUICtrlSetState($Button13,$GUI_FOCUS)
GUICtrlCreateLabel("",0,156,402,2,16)
$CreateIcon = GUICtrlCreateIcon("urlmon.dll",36869,15,173)
GUICtrlCreateLabel("来自 Internet 的文件可能对您有所帮助,但此文件类型可" & @CR & "能危害您的计算机。如果您不信任其来源,请不要运行或保" & @CR & "存该软件。",60,171,323,45)
$MainPage = GUICtrlCreateLabel("有何风险?",120,195)
GUICtrlSetFont(-1,9,-1,4)
GUICtrlSetColor(-1,0x000090)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
;运行 - 保存网络文件到当前文件夹,下载完成后运行
;保存 - 显示文件保存对话框 - FileSaveDialog("标题","起始目录","文件类型" [, 选项 [, "默认文件名" [, 窗口句柄]]] )
;取消 - 退出程序
WEnd
GUIDelete()
;设置快捷键
;计算各部分的数据值及处理单位类型,例如:小时、分钟、秒、GB、MB、KB、B
$WinMain = GUICreate("已完成安装 " & "88" & "% - " & "...504_Business_chs_Set...",413,222,-1,-1,$GUI_SS_DEFAULT_GUI,$WS_EX_DLGMODALFRAME)
;当传输速度为0时标题栏显示为:文件下载
$CreateAvi = GUICtrlCreateAvi("download.avi",0,11,0,230,32,$ACS_AUTOPLAY)
$GetInfo = GUICtrlCreateLabel("获取文件信息:",11,65,381)
GUICtrlCreateLabel("...504_Business_chs_Setup.msi" & " (来自 " & "cdn05.foxitsoftware.com" & ")",11,80,381)
GUICtrlCreateProgress(11,95,392,12)
GUICtrlCreateLabel("估计剩余时间:",11,110,105)
GUICtrlCreateLabel("8" & " 分钟 " & "8" & " 秒 (已复制 " & "212" & "MB,共 " & "241" & "MB)",105,110)
GUICtrlCreateLabel("下载到:",11,125,60)
GUICtrlCreateLabel("...\FoxitPhantomPDF504_Business_chs_S...",105,125)
GUICtrlCreateLabel("传输速度:",11,140,75)
GUICtrlCreateLabel("99.9" & "KB" & "/秒",105,140)
;传输速度的数字部分 <= 4 位
$Checkbox21 = GUICtrlCreateCheckbox("下载完成后关闭此对话框(&C)",11,156,381)
$Button21 = GUICtrlCreateButton("打开(&O)",120,194,90,21)
GUICtrlSetState($Button21,$GUI_DISABLE)
$Button22 = GUICtrlCreateButton("打开文件夹(&F)",216,194,90,21)
GUICtrlSetState($Button22,$GUI_DISABLE)
$Button23 = GUICtrlCreateButton("取消",312,194,90,21)
GUICtrlSetState($Button23,$GUI_FOCUS)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
;取消 - 退出程序
Sleep(1000)
GUICtrlSetData($GetInfo,"")
ExitLoop
WEnd
GUIDelete()
$WinMain = GUICreate("下载完毕",413,222,-1,-1,$GUI_SS_DEFAULT_GUI,$WS_EX_DLGMODALFRAME)
$CreateIcon = GUICtrlCreateIcon("ieframe.dll",13104,11,15)
GUICtrlCreateLabel("下载完毕",68,30)
GUICtrlCreateLabel("...504_Business_chs_Setup.msi" & " (来自 " & "cdn05.foxitsoftware.com" & ")",11,80,392)
GUICtrlCreateProgress(11,95,392,12)
GUICtrlCreateLabel("已下载:",11,110,105)
GUICtrlCreateLabel("241" & "MB" & "(总共 " & "10" & " 分钟 " & "10" & " 秒)",105,110)
GUICtrlCreateLabel("下载到:",11,125,60)
GUICtrlCreateLabel("..." & "" & "FoxitPhantomPDF504_Business_chs_S...",105,125)
GUICtrlCreateLabel("传输速度:",11,140,75)
GUICtrlCreateLabel("170" & "KB" & "/秒",105,140)
$Checkbox31 = GUICtrlCreateCheckbox("下载完成后关闭此对话框(&C)",11,156,392)
$Button31 = GUICtrlCreateButton("运行(&R)",120,194,90,21)
$Button32 = GUICtrlCreateButton("打开文件夹(&F)",216,194,90,21)
$Button33 = GUICtrlCreateButton("关闭",312,194,90,21)
GUICtrlSetState($Button33,$GUI_FOCUS)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
;运行 - 运行已下载的文件
;打开文件夹 - 打开 文件保存对话框中选择的路径
;关闭 - 退出程序
WEnd
GUIDelete()