Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set DEFAULT to a form's directory in INIT()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00883530
Message ID:
00883541
Vues:
13
>To all,
>
>I'm trying to make an app self-contained and the first step appears to be setting DEFAULT to the directory in which the app exists.
>
>I've tried SYS(5) + SYS(2003) but that gives me the current default dir.
>
>I'm trying to automatically determine the directory in which the form/exe exists.
>
>TIA,
>Thom C.

This will get the path to the exe. If you run the app from VFP it will return the path to the VFP exe - so you might want to check version(2) <> 2.
DECLARE INTEGER GetModuleFileName IN Win32API ;
        INTEGER hModule, ;
        STRING  @Path, ;
        INTEGER cchPath

lc_path   = SPACE(256)
ln_szpath = GetModuleFileName(0, @lc_path, LEN(lc_path))
lc_path   = LEFT(lc_path, ln_szpath)
? lc_path
Charles

"The code knows no master." - Chuck Mautz
"Everybody is ignorant, only on different subjects." - Will Rogers
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform