by ShumingWang » Sat May 05, 2007 8:08 am
Antonio,
The main my.exe file is still exist in memory and running during winexe("copyfile.exe").
#include "FiveWin.ch"
function Main()
local lUpgrade := .F.
DEFINE DIALOG oDlg RESOURCE "odlg"
@ 2, 2 BUTTON "Upgrade" OF oDlg SIZE 80, 20 ;
ACTION ( lUpgrade := .T., oDlg:End() )
ACTIVATE DIALOG oDlg
if lUpgrade
hLib = LOADLIBRARY( "urlmon.dll")
URLDownloadToFile( 0, "www.my.com/down/my.exe", ".\tmp\my.exe", 0, 0 ) == 0
FREELIBRARY( hLib )
WinExec( "copyfile.exe" )
endif
return nil
DLL32 FUNCTION URLDownloadToFile(pCaller AS LONG,szURL AS STRING, szFileName AS STRING, dwReserved AS LONG, lpfnCB AS LONG);
AS LONG PASCAL;
FROM "URLDownloadToFileA";
LIB hlib
copyfile.prg
#include "fivewin.ch"
FUNCTION main(cpath)
local afiles
msgwait("正在更新文件","",2)
afiles:=directory(".\tmp\*.*")
for i:=1 to len(afiles)
copyfile( "\"+CURDIR()+"\tmp\"+afiles[i,1] ,afiles[i,1] ,.f.)
next
winexec("my.exe")
return
Thank you!
Shuming Wang