风一样的男孩 发表于 2009-6-15 14:58:07

AU3自动下载并自动安装的代码

t#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
Dim $under, $upon, $per, $res, $filesize, $Inetget, $setup;定义变量
$Form1 = GUICreate("Form1", 200, 8, @DesktopWidth/2-100, 1, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW + $WS_EX_LAYERED) ;创建窗体
GUISetBkColor(0xABCDEF)
_API_SetLayeredWindowAttributes($Form1, 0xABCDEF)
ToolTip("■■■■■软件正在安装中,请稍后■■■■", 400, 200)
$Inetget = "http://192.168.0.244/download/speak/yy.exe";;;
$setup = "d:\yy.exe"
$under = InetGetSize($Inetget) ;获取目标文件大小
InetGet($Inetget, $setup, 1, 1) ;下载目标文件
GUISetState()

While @InetGetActive ;判定循环条件
      Sleep(100)
      $upon = @InetGetBytesRead ;获取已下载大小
      $per = $upon / $under * 100 ;计算比值
      $res = StringLeft($per, 3) ;计算百分值
      GUICtrlSetData(-1, $res) ;下载进度的值
WEnd
GUISetState (@SW_HIDE,$Form1)
Run($setup)
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)

Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
If Not $isColorRef Then
   $i_transcolor = Hex(String($i_transcolor), 6)
   $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
Select
   Case @error
    Return SetError(@error, 0, 0)
   Case $Ret = 0
    Return SetError(4, 0, 0)
   Case Else
    Return 1
EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes


feitian 发表于 2009-6-15 15:43:49

自动下载什么东西呢?

z1363499 发表于 2009-6-15 20:10:20

这是什么 ????

killzhaojun 发表于 2009-7-15 11:52:06

下什么?

剑二十三 发表于 2009-9-6 17:27:35

时代电脑 发表于 2010-1-14 22:28:54

很想学编情,但资质有限

a55901 发表于 2010-1-19 12:57:21

这是什么 ????
页: [1]
查看完整版本: AU3自动下载并自动安装的代码