Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP exe Location Determination
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP3
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01605250
Message ID:
01605811
Vues:
82
I use this function from wwUtils.prg to reliably return the start path regardless of how VFP was started (including COM, .APP, or ActiveDoc). Not 100% sure about network drives - I think you get back either the mapped drive or UNC mapping depending on which you used to start VFP or your VFP app.
************************************************************************
FUNCTION GetAppStartPath
*********************************
***  Function: Returns the FoxPro start path
***            of the *APPLICATION*
***            under all startmodes supported by VFP.
***            Returns the path of the starting EXE, 
***            DLL, APP, PRG/FXP
***    Return: Path including drive letter\UNC network path
************************************************************************

DO CASE 
   *** VFP 6 and later provides ServerName property for COM servers EXE/DLL/MTDLL
   CASE INLIST(_VFP.StartMode,2,3,5) 
         lcPath = JustPath(_VFP.ServerName)

   *** Interactive
   CASE (_VFP.StartMode) = 0
         lcPath = SYS(5) + CURDIR()
         
   *** Active Document
   CASE ATC(".APP",SYS(16,0)) > 0
       lcPath = JustPath(SYS(16,0))

  *** Standalone EXE or VFP Development
  OTHERWISE
       lcPath = JustPath(SYS(16,0))
       IF ATC("PROCEDURE",lcPath) > 0
         lcPath = SUBSTR(lcPath,RAT(":",lcPath)-1)
       ENDIF
ENDCASE

RETURN AddBs(lcPath)
* EOF GetAppStartPath 
>Hi Gang!
>
>Question.....
>
>Given a FoxPro EXE that is located in a folder somewhere..... could be ANYWHERE on the network.
>
>Any built in fuction or home made procedure that can give me the DRIVE (or VOLUME) and the PATH to where the EXE is located, when it is running?
>
>The EXE can be run from some other FoxPro EXE, so it will NOT be started from a Windows Shortcut. It should be able to be tested by double-clicking on the EXE, wherever it is located.
>
>
>Thanks
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform