app auto upgrade
Posted: Thu Nov 29, 2012 3:13 am
Hi !
I want self upgrade,code like :
1. app.prg
#include "fivewin.ch"
FUNCTION main()
local odlg
define DIALOG odlg
@1,1 button "updatde" OF odlg action (odlg:end(),winexec("download.exe"))
activate dialog odlg
return
2. download.prg :
#include "fivewin.ch"
#include "dll.ch"
static hLib
FUNCTION main()
hLib = LOADLIBRARY( "urlmon.dll")
if URLDownloadToFile( 0, "http://www.xtech.com.cn/down/app.exe", ".\app.exe", 0, 0 )<>0
?"error"
end
FREELIBRARY( hLib )
return
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
================
Run time error, it seems main app.exe still running ,not closed
Regards!
Shuming Wang
I want self upgrade,code like :
1. app.prg
#include "fivewin.ch"
FUNCTION main()
local odlg
define DIALOG odlg
@1,1 button "updatde" OF odlg action (odlg:end(),winexec("download.exe"))
activate dialog odlg
return
2. download.prg :
#include "fivewin.ch"
#include "dll.ch"
static hLib
FUNCTION main()
hLib = LOADLIBRARY( "urlmon.dll")
if URLDownloadToFile( 0, "http://www.xtech.com.cn/down/app.exe", ".\app.exe", 0, 0 )<>0
?"error"
end
FREELIBRARY( hLib )
return
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
================
Run time error, it seems main app.exe still running ,not closed
Regards!
Shuming Wang