Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kicking users out of a VFP EXE
Message
De
11/07/2003 02:10:34
Michael Ouellette
Australian Technical Services (VIC) Pty
Australie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00809088
Message ID:
00809112
Vues:
39
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
Fil
Voir

Click here to load this message in the networking platform