在论坛上看到有一个COPY程序,于是想运用到程序的在线更新中去,我这是网吧环境,出现这样一个问题,我运行的本程序,在本程序上面执行"在线更新",按照顾上面的源地址和目标地址来的话,就会出错,因为本身存在,而且在运行,在其它位置运行OK,要表达的也就是怎样在远程更新时,覆盖自身!或其它什么解决方法!在线更新源代码如下:
Global Const $PROGRESS_CONTINUE = 0
Global Const $PROGRESS_CANCEL = 1
Global Const $PROGRESS_STOP = 2
Global Const $PROGRESS_QUIET = 3
_FileCopyEx("\\192.168.0.136\update$\影视程序.exe", "e:\通用工具\影视工具\影视程序.exe")
Func _FileCopyEx($Source, $Dest)
If Not FileExists($Source) Then Return SetError(1, 0, 0);检查文件是否存在
ProgressOn("在线更新程序", "正在更新, 请稍候...") ;开启进度条,此处可以换成其他控件
$pCopyProgressRoutine = DllCallbackRegister("_CopyProgressRoutine", "int", "uint64;uint64;uint64;uint64;dword;dword;ptr;ptr;ptr");注册callback函数
DllCall("kernel32.dll", "int", "CopyFileEx", _
"str", $Source, _
"str", $Dest, _
"ptr", DllCallbackGetPtr($pCopyProgressRoutine), _
"ptr", 0, _
"int", 0, _
"int", 0);调用API,第三个参数是callback函数的指针,文件每复制一段时间就调用这个callback函数
DllCallbackFree($pCopyProgressRoutine);释放
EndFunc
Func _CopyProgressRoutine($TotalFileSize, $TotalBytesTransferred, $StreamSize, $StreamBytesTransferred, $dwStreamNumber, $dwCallbackReason, $hSourceFile, $hDestinationFile, $lpData)
;TotalFileSize:文件大小
;TotalBytesTransferred:已传输文件大小
$Percent = $TotalBytesTransferred / $TotalFileSize * 100
ProgressSet($Percent, "已完成: " & Round($Percent, 1) & "%") ;设置进度
Return $PROGRESS_CONTINUE ;通过返回这个值来告诉系统继续复制,返回返回 PROGRESS_CANCEL终止
EndFunc ;==>_CopyProgressRoutine
影视程序全源码如下:客户机位置在e:\通用工具\影视工具\影视工具.exe
服务器放在共享中,用FTP好像不行样!
#NoTrayIcon
#include <GUIConstants.au3>
#include <process.au3>
#include <ButtonConstants.au3>
#include <GuiStatusBar.au3>
#include <IE.au3>
#Include <Date.au3>
#include <EditConstants.au3>
$g_szVersion = "fxwlc"
If WinExists($g_szVersion) Then
MsgBox(32, "温馨提示", "注意已经运行了",1)
Exit ; 此脚本已经运行了
EndIf
AutoItWinSetTitle($g_szVersion)
Opt("GUIOneventMode",1);应用OnEvent函数于系统托盘图标
Opt("guicloseonesc", 0) ;此处为程序运行时按下ESC不发送消息,否则按下ESC键后,退出程序
Opt("onexitfunc", "quit") ;设置脚本退出时调用的函数
Dim $Button[66],$lr[3],$CD,$an[10],$name[5],$pwd[5],$Button1[13]
FileInstall("SkinCrafterDll.dll", @TempDir & "\SkinCrafterDll.dll", 1)
FileInstall("vista.skf", @TempDir & "\vista.skf", 1)
FileInstall("top.jpg", @TempDir & "\top.jpg ", 1)
$Dll = DllOpen(@TempDir & "\SkinCrafterDll.dll")
;=====================在线更新==========================
Global Const $PROGRESS_CONTINUE = 0
Global Const $PROGRESS_CANCEL = 1
Global Const $PROGRESS_STOP = 2
Global Const $PROGRESS_QUIET = 3
;=====================在线更新==========================
$WinMain = GUICreate("【飛翔網絡】欢迎您!", 440, 280) ;创建主窗口
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $WinMain, "int", 500, "long", 0x00040010);explode
_SkinGUI(@TempDir & "\SkinCrafterDll.dll", @TempDir & "\vista.skf", $WinMain)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ;注册窗口关闭事件到函数_Exit
;GUICtrlCreateButton ( "文本", 左侧, 上方 [, 宽度 [, 高度 [, 样式 [, 扩展样式]]]] )
;GUISetBkColor(0xf66ccc)
$an[0] = GUICtrlCreateGroup("快速通道",0,5,67,255)
$Button[0] = GUICtrlCreateButton("专线影院", 3, 20, 60, 32);显示子窗口 4 3, 122, 60, 32
$Button[1] = GUICtrlCreateButton("网吧影院", 3, 54, 60, 32);显示子窗口 1 3, 20, 60, 32
$Button[2] = GUICtrlCreateButton("留言中心", 3, 88, 60, 32);显示子窗口 3 3, 88, 60, 32
$Button[3] = GUICtrlCreateButton("下载中心", 3, 122, 60, 32);显示子窗口 2 3, 54, 60, 32
$Button[4] = GUICtrlCreateButton("网络测试", 3, 156, 60, 32);显示子窗口 5
$Button[6] = GUICtrlCreateButton("QQ留言", 3, 190, 60, 32);3, 224, 60, 32
$Button[7] = GUICtrlCreateButton("退出程序", 3, 224, 60, 32);显示子窗口 8
$Button[8] = GUICtrlCreateButton("全部", 83, 50, 45, 20)
$Button[9] = GUICtrlCreateButton("网页", 143, 50, 45, 20)
$Button[10] = GUICtrlCreateButton("影视", 203, 50, 45, 20)
$Button[11] = GUICtrlCreateButton("在线", 263, 50, 45, 20)
$Button[12] = GUICtrlCreateButton("音乐", 323, 50, 45, 20)
$Button[13] = GUICtrlCreateButton("歌词", 383, 50, 45, 20)
$Button[14] = GUICtrlCreateButton("图片", 83, 72, 45, 20)
$Button[15] = GUICtrlCreateButton("书籍", 143, 72, 45, 20)
$Button[16] = GUICtrlCreateButton("软件", 203, 72, 45, 20)
$Button[17] = GUICtrlCreateButton("游戏", 263, 72, 45, 20)
$Button[18] = GUICtrlCreateButton("全集", 323, 72, 45, 20)
$Button[19] = GUICtrlCreateButton("知道", 383, 72, 45, 20)
$Button[20] = GUICtrlCreateButton("新闻", 323, 23, 45, 20)
$Button[21] = GUICtrlCreateButton("贴吧", 383, 23, 45, 20)
;===============================电视直播=======================================
$Button[22] = GUICtrlCreateButton("BTV北京 ", 73, 115, 50, 25)
$Button[23] = GUICtrlCreateButton("CCTV1套", 125, 115, 50, 25)
$Button[24] = GUICtrlCreateButton("CCTV3套", 177, 115, 50, 25)
$Button[25] = GUICtrlCreateButton("CCTV5套", 229, 115, 50, 25)
$Button[26] = GUICtrlCreateButton("CCTV6套", 281, 115, 50, 25)
$Button[27] = GUICtrlCreateButton("CCTV10套", 333, 115, 50, 25)
$Button[28] = GUICtrlCreateButton("CCTV12套", 385, 115, 50, 25)
$Button[29] = GUICtrlCreateButton("成都1套", 73, 143, 50, 25)
$Button[30] = GUICtrlCreateButton("成都3套", 125, 143, 50, 25)
$Button[31] = GUICtrlCreateButton("成都4套", 177, 143, 50, 25)
$Button[32] = GUICtrlCreateButton("四川3套", 229, 143, 50, 25)
$Button[33] = GUICtrlCreateButton("四川4套", 281, 143, 50, 25)
$Button[34] = GUICtrlCreateButton("四川5套", 333, 143, 50, 25)
$Button[35] = GUICtrlCreateButton("四川6套", 385, 143, 50, 25)
$Button[36] = GUICtrlCreateButton("科教频道", 73,171, 50, 25)
$Button[37] = GUICtrlCreateButton("重庆卫视", 125, 171, 50, 25)
$Button[38] = GUICtrlCreateButton("陕西卫视", 177, 171, 50, 25)
$Button[39] = GUICtrlCreateButton("峨嵋电影", 229, 171, 50, 25)
$Button[40] = GUICtrlCreateButton("湖南卫视", 281, 171, 50, 25)
$Button[41] = GUICtrlCreateButton("中国教育", 333, 171, 50, 25)
$Button[42] = GUICtrlCreateButton("上海卫视", 385, 171, 50, 25)
$Button[43] = GUICtrlCreateButton("江西电视", 73, 199, 50, 25)
$Button[44] = GUICtrlCreateButton("江苏卫视", 125, 199, 50, 25)
$Button[45] = GUICtrlCreateButton("深圳电视", 177, 199, 50, 25)
$Button[46] = GUICtrlCreateButton("浙江电视 ", 229, 199, 50, 25)
$Button[47] = GUICtrlCreateButton("山东卫视", 281, 199, 50, 25)
$Button[48] = GUICtrlCreateButton("安徽电视", 333, 199, 50, 25)
$Button[49] = GUICtrlCreateButton("广东卫视", 385, 199, 50, 25)
$Button1[11] = GUICtrlCreateButton ("在线更新",385, 235, 50, 25)
;GuiCtrlCreatePic("\\192.168.0.136\update$\au3\logo.jpg",68,100, 370,153)
$an[1]= GUICtrlCreateGroup("搜索工具",70,5,370,95)
$an[2]= GUICtrlCreateInput("在此输入查找内容……", 80, 20, 230, 25)
$an[3] = GUICtrlCreateGroup("在线电视", 68,100, 370,133)
;=================添加时间=============================
GuiCtrlCreateDate("", 113, 238, 110, 20)
$Label1= GUICtrlCreateLabel("Label1", 68, 242, 45, 18)
$Label2= GUICtrlCreateLabel("Label2", 225, 242, 105, 20)
$Button1[6] = GUICtrlCreateButton("关于", 333, 235, 50, 25)
$StatusBar1 = _GUICtrlStatusBar_Create($WinMain)
Dim $StatusBar1_PartsWidth[3] = [100, 220, 400]
Dim $S0 = " 欢迎光临 ", $S1 = "飛翔網絡 By Jycel", $S2=" QQ:472891322 E-mail:jycel@qq.com"
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, $S2, 2)
_GUICtrlStatusBar_SetText($StatusBar1, $S1, 1)
_GUICtrlStatusBar_SetText($StatusBar1, $S0, 0)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 15)
;===========================创建子窗口=============================
$WinSub1 = GUICreate("在线影院", 220, 60) ;创建子窗口1
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button1[0] = GUICtrlCreateButton("电信专线影院", 5, 5, 100, 50,$BS_DEFPUSHBUTTON)
$Button1[1] = GUICtrlCreateButton("电信专线主页", 110, 5, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub2 = GUICreate("下载中心", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button1[2]= GUICtrlCreateButton("FTP地址1", 5, 5, 100, 50,$BS_DEFPUSHBUTTON)
$Button1[3]= GUICtrlCreateButton("FTP地址2", 110, 5, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub3 = GUICreate("网络测试", 220, 60) ;创建子窗口2
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button1[4] = GUICtrlCreateButton("内网测试", 5, 5, 100, 50,$BS_DEFPUSHBUTTON)
$Button1[5] = GUICtrlCreateButton("外网测试", 110, 5, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
$WinSub4 = GUICreate("关于程序", 220, 200)
$Button1[7]=GUICtrlCreateLabel(" 程序说明"&@crlf&@crlf&" 本程序包含在线电影、电视直播、网络检测、狗狗搜索等!"&@crlf&@crlf&" 如果你对本程序有任何见意请点击程序上面的QQ留言!"&@crlf&@crlf&"程序作者:飞翔浪子"&@crlf&@crlf&"联系QQ:472891322"&@crlf&@crlf&"E-mail:jycel@qq.com", 0, 0, 220, 180);
$Button1[8] = GUICtrlCreateButton("返回", 70, 175, 65, 25);创建子窗口中按钮二
$WinSub5 = GUICreate("网吧影院", 220, 60) ;创建子窗口1
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg") ;注册窗口关闭事件到函数GUICtrlMsg
$Button1[9] = GUICtrlCreateButton("网吧影院[绵阳]", 5, 5, 100, 50,$BS_DEFPUSHBUTTON)
$Button1[10]= GUICtrlCreateButton("网吧影院[本地]", 110, 5, 100, 50,$BS_DEFPUSHBUTTON);创建子窗口中按钮二
For $I = 65 to 0 Step -1
GUICtrlSetOnEvent($Button[$I],"GUICtrlMsg") ;注册总共的六个按钮点击事件到函数 GUICtrlMsg
;请区分 GUISetOnEvent 和 GUICtrlSetOnEvent的区别
Next
For $j = 12 to 0 Step -1
GUICtrlSetOnEvent($Button1[$j],"GUICtrlMsg") ;注册总共的六个按钮点击事件到函数 GUICtrlMsg
;请区分 GUISetOnEvent 和 GUICtrlSetOnEvent的区别
Next
GUISwitch($WinMain) ;切换当前窗口到主窗口
GUISetState(@SW_SHOW) ;显示当前窗口
While 1
GUICtrlSetData($Label1,"今天是:")
GUICtrlSetData($Label2,"当前时间:"&@HOUR&':'&@MIN&':'&@SEC)
Sleep(1000)
WEnd
Func GUICtrlMsg()
Switch @GUI_CtrlId;选择事件 ID 或 控件 ID
Case $GUI_EVENT_CLOSE;如果点下的是$GUI_EVENT_CLOSE(关闭)
GUISetState(@SW_HIDE,@GUI_WinHandle); 隐藏产生事件的窗口
Case $Button[0]
GUISetState(@SW_SHOW,$WinSub1); 隐藏 子窗口 1
Case $Button[1]
GUISetState(@SW_SHOW,$WinSub5); 隐藏 子窗口 1
;=========================留言中心=====================
Case $Button[2]
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://192.168.0.136/ly/")
;=========================专网电影=====================
Case $Button[3]
GUISetState(@SW_SHOW,$WinSub2); 隐藏 子窗口 1
Case $Button[4]
GUISetState(@SW_SHOW,$WinSub3); 隐藏 子窗口 1
;=================QQ留言==============================
Case $Button[6]
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe tencent://Message/?Uin=472891322")
;=========================退出程序=====================
Case $Button[7]
_Exit()
;=========================在线影院=====================
Case $Button1[0]
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://20.20.2.102/webmedia/html/index.shtml")
GUISetState(@SW_HIDE,$WinSub1); 隐藏 子窗口 1
Case $Button1[1]
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://www.fxwlc2624067.51hdwm.com")
GUISetState(@SW_HIDE,$WinSub1); 隐藏 子窗口 1
;=========================网络检测=====================
Case $Button1[2]
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe ftp://192.168.0.136")
GUISetState(@SW_HIDE,$WinSub2); 隐藏 子窗口 2
Case $Button1[3]
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe ftp://192.168.0.254")
GUISetState(@SW_HIDE,$WinSub2); 隐藏 子窗口 2
;=========================网络检测=====================
Case $Button1[4]
MsgBox(0,"网络测试"," 请注意"&@CRLF&@CRLF&"如果一直出现[Request timed out.]说明网络未连接"&@CRLF&"确定开始测试"&@CRLF&@CRLF&"请不要动鼠标,等待程序自动退出")
_Rundos("start cmd")
Sleep(100)
send("ping 192.168.0.1 -t -n 5")
sleep(200)
send("{ENTER}")
Sleep(5300)
Send("exit")
Sleep(100)
send("{ENTER}")
GUISetState(@SW_HIDE,$WinSub3); 隐藏 子窗口 2
Case $Button1[5]
MsgBox(0,"网络测试"," 请注意"&@CRLF&@CRLF&"如果一直出现[Request timed out.]说明网络未连接"&@CRLF&"确定开始测试"&@CRLF&@CRLF&"请不要动鼠标,等待程序自动退出")
_Rundos("start cmd")
Sleep(100)
send("ping 202.98.96.68 -t -n 5")
sleep(200)
send("{ENTER}")
Sleep(5300)
Send("exit")
Sleep(100)
send("{ENTER}")
GUISetState(@SW_HIDE,$WinSub3); 隐藏 子窗口 2
Case $Button1[6]
GUISetState(@SW_SHOW,$WinSub4); 隐藏 子窗口 1
Case $Button1[8]
GUISetState(@SW_HIDE,$WinSub4); 隐藏 子窗口 2
Case $Button1[9]
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://hack793.host.vhost100.cn")
GUISetState(@SW_HIDE,$WinSub5); 隐藏 子窗口 2
Case $Button1[10]
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://192.168.0.136")
GUISetState(@SW_HIDE,$WinSub5); 隐藏 子窗口 2
case $Button1[11]
MsgBox(0,"更新提示","程序更新完毕后会自动退出"&@CRLF&"请重新启动程序")
_FileCopyEx("\\192.168.0.136\update$\Download\影视工具.exe", "e:\通用工具\影视工具\影视工具.exe")
;========================================gougou===================================
Case $Button[8]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://www.gougou.com/search?search=" & $CD)
Case $Button[9]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://web.gougou.com/search?search=" & $CD)
;ShellExecute("http://web.gougou.com/search?search=" & $CD, "", "", "", 1)
Case $Button[10]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://movie.gougou.com/search?search=" & $CD)
;ShellExecute("http://movie.gougou.com/search?search=" & $CD, "", "", "", 1)
Case $Button[11]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://video.gougou.com/search?s=" & $CD)
;ShellExecute("http://video.gougou.com/search?s=" & $CD, "", "", "", 1)
Case $Button[12]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://mp3.gougou.com/search?search=" & $CD)
;ShellExecute("http://mp3.gougou.com/search?search=" & $CD, "", "", "", 1)
Case $Button[13]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://mp3.gougou.com/lrc?search=" & $CD)
;ShellExecute("http://mp3.gougou.com/lrc?search=" & $CD, "", "", "", 1)
Case $Button[14]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://pic.gougou.com/search?search=" & $CD)
;ShellExecute("http://pic.gougou.com/search?search=" & $CD, "", "", "", 1)
Case $Button[15]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://book.gougou.com/search?search=" & $CD)
;ShellExecute("http://book.gougou.com/search?search=" & $CD, "", "", "", 1)
Case $Button[16]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://soft.gougou.com/search?search=" & $CD)
;ShellExecute("http://soft.gougou.com/search?search=" & $CD, "", "", "", 1)
Case $Button[17]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://game.gougou.com/search?search=" & $CD)
;ShellExecute("http://game.gougou.com/search?search=" & $CD, "", "", "", 1)
Case $Button[18]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://blog.gougou.com/search?search=" & $CD)
;ShellExecute("http://blog.gougou.com/search?search=" & $CD, "", "", "", 1)
Case $Button[19]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://zhidao.baidu.com/?t=50&q=" & $CD)
;ShellExecute("http://zhidao.baidu.com/?t=50&q=" & $CD, "", "", "", 1)
Case $Button[20]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://news.baidu.com/ns?word=" & $CD)
;ShellExecute("http://news.baidu.com/ns?word=" & $CD, "", "", "", 1)
Case $Button[21]
$CD= GUICtrlRead($an[2])
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://tieba.baidu.com/f?kw="& $CD)
;ShellExecute("http://tieba.baidu.com/f?kw=" & $CD, "", "", "", 1)
;==========================电视直播==================================
Case $Button[22]
ShellExecute("mms://20.20.2.100/111", "", "", "", 1)
;_Rundos("start mms://20.20.2.100/111")
Case $Button[23]
_Rundos("start mms://20.20.2.100/114")
Case $Button[24]
_Rundos("start mms://20.20.2.100/105")
Case $Button[25]
_Rundos("start mms://20.20.2.100/125")
Case $Button[26]
_Rundos("start mms://20.20.2.100/108")
Case $Button[27]
_Rundos("start mms://20.20.2.100/123")
Case $Button[28]
_Rundos("start mms://20.20.2.100/110")
Case $Button[29]
_Rundos("start mms://20.20.2.100/103")
Case $Button[30]
_Rundos("start mms://20.20.2.100/131")
Case $Button[31]
_Rundos("start mms://20.20.2.100/115")
Case $Button[32]
_Rundos("start mms://20.20.2.100/106")
Case $Button[33]
_Rundos("start mms://20.20.2.100/109")
Case $Button[34]
_Rundos("start mms://20.20.2.100/107")
Case $Button[35]
_Rundos("start mms://20.20.2.100/102")
Case $Button[36]
_Rundos("start mms://20.20.2.100/122")
Case $Button[37]
_Rundos("start mms://20.20.2.100/121")
Case $Button[38]
_Rundos("start mms://20.20.2.100/101")
Case $Button[39]
_Rundos("start mms://20.20.2.100/124")
Case $Button[40]
_Rundos("start mms://20.20.2.100/128")
Case $Button[41]
_Rundos("start mms://20.20.2.100/104")
Case $Button[42]
_Rundos("start mms://20.20.2.100/113")
Case $Button[43]
_Rundos("start mms://20.20.2.100/117")
Case $Button[44]
_Rundos("start mms://20.20.2.100/118")
Case $Button[45]
_Rundos("start mms://20.20.2.100/119")
Case $Button[46]
_Rundos("start mms://20.20.2.100/112")
Case $Button[47]
_Rundos("start mms://20.20.2.100/126")
Case $Button[48]
_Rundos("start mms://20.20.2.100/116")
Case $Button[49]
_Rundos("start mms://20.20.2.100/120")
EndSwitch
EndFunc
;添加浏览安装目录
;Func open()
; AdlibDisable()
; $InstallPath = FileSelectFolder("选择安装目录", "") ;显示一个文件夹选择对话框
; If Not @error Then
; If StringRight($InstallPath, 1) = "\" Then ;StringRight为返回字符串中从右开始指定数量的字符
; GUICtrlSetData($input1, $InstallPath & "") ;GUICtrlSetData为修改指定控件的相关数据
; Else
GUICtrlSetData($input1, $InstallPath & "\")
; EndIf
; MsgBox(4096, "测试", $InstallPath)
; EndIf
;EndFunc ;==>open
;定义皮肤函数
Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)
$Dll = DllOpen($SkincrafterDll)
DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)
DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)
DllCall($Dll, "int:cdecl", "ApplySkin")
EndFunc ;==>_SkinGUI
Func Quit()
GUISetState(@SW_HIDE)
DllCall($Dll, "int:cdecl", "DeInitDecoration")
DllCall($Dll, "int:cdecl", "RemoveSkin")
DllClose($Dll)
FileDelete(@TempDir & "\SkinCrafterDll.dll")
FileDelete(@TempDir & "\vista.skf")
FileDelete(@TempDir & "\top.jpg")
Exit
EndFunc ;==>Quit
Func _FileCopyEx($Source, $Dest)
If Not FileExists($Source) Then Return SetError(1, 0, 0);检查文件是否存在
ProgressOn("在线更新程序", "正在更新, 请稍候...") ;开启进度条,此处可以换成其他控件
$pCopyProgressRoutine = DllCallbackRegister("_CopyProgressRoutine", "int", "uint64;uint64;uint64;uint64;dword;dword;ptr;ptr;ptr");注册callback函数
DllCall("kernel32.dll", "int", "CopyFileEx", _
"str", $Source, _
"str", $Dest, _
"ptr", DllCallbackGetPtr($pCopyProgressRoutine), _
"ptr", 0, _
"int", 0, _
"int", 0);调用API,第三个参数是callback函数的指针,文件每复制一段时间就调用这个callback函数
DllCallbackFree($pCopyProgressRoutine);释放
_Exit()
EndFunc
Func _CopyProgressRoutine($TotalFileSize, $TotalBytesTransferred, $StreamSize, $StreamBytesTransferred, $dwStreamNumber, $dwCallbackReason, $hSourceFile, $hDestinationFile, $lpData)
;TotalFileSize:文件大小
;TotalBytesTransferred:已传输文件大小
$Percent = $TotalBytesTransferred / $TotalFileSize * 100
ProgressSet($Percent, "已完成: " & Round($Percent, 1) & "%") ;设置进度
Return $PROGRESS_CONTINUE ;通过返回这个值来告诉系统继续复制,返回返回 PROGRESS_CANCEL终止
EndFunc ;==>_CopyProgressRoutine
Func _Exit()
dllCall("user32.dll", "int", "AnimateWindow", "hwnd", $WinMain, "int", 1000, "long", 0x00050010);向中间隐小
Exit
EndFunc
[ 本帖最后由 jycel 于 2009-3-18 15:50 编辑 ] |