Information générale
Catégorie:
Codage, syntaxe et commandes
I put this code at the beginning of all my applications. This runs the latest version of my exe next time the user logs on:
* Abstract...: Checks for newer versions of an exe and runs it!
If right(justfname(sys(16)),3)='EXE'
* first exe=myprog.exe, subsequent exe's=myprog1.exe etc
ex=ADIR(executables,'myprog*.exe')
* ex=0 if no files , but then that's impossible since this file is an exe!
* sort with latest file on top
=asort(executables,3,-1,1)
* returns -1 if not sorted
* this file running..
thisexe=upper(justfname(sys(16)))
newexe=upper(executables[1])
If newexe<>thisexe
Wait window 'Running latest exe' nowait
Local lcFileName,lcWorkDir,lcOperation
tcOperation=""
tcWorkDir=sys(5)+sys(2003)+"\"
tcFileName= newexe
If EMPTY(tcFileName)
Return -1
Endif
lcFileName=ALLTRIM(tcFileName)
lcWorkDir=IIF(TYPE("tcWorkDir")="C",ALLTRIM(tcWorkDir),"")
lcOperation=IIF(TYPE("tcOperation")="C" AND NOT EMPTY(tcOperation),ALLTRIM(tcOperation),"Open")
Declare INTEGER ShellExecute ;
IN SHELL32.DLL ;
INTEGER nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
=ShellExecute(0,lcOperation,lcFileName,"",lcWorkDir,1)
* if I run the new exe then quit this one.
Quit
Endif
****** end check for newest version
Endif right(justfname(sys(16)),3)
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement