app auto upgrade

app auto upgrade

Postby ShumingWang » 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
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: app auto upgrade

Postby Enrico Maria Giordano » Thu Nov 29, 2012 12:09 pm

Try to delete the original EXE in a loop up to it's deleted.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: app auto upgrade

Postby Patrizio » Thu Nov 29, 2012 12:28 pm

I wait for 60 seconds and if I can't delete the original .exe I return an error (it may be used from another user)
Patrizio
 
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy

Re: app auto upgrade

Postby Adolfo » Thu Nov 29, 2012 3:16 pm

Shuming Wang

Here you have all you want to do.
http://bielsys.blogspot.com/

Have a look at "ACTUALIZACION AUTOMATICA", there are samples to do it by LAN, and via ftp

Greetings from Chile
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: app auto upgrade

Postby ShumingWang » Fri Nov 30, 2012 1:38 am

Adolfo,
Could you post here ? for in our counrty many web/ip be forbidden.
Regards!
Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 102 guests