Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set DEFAULT to a form's directory in INIT()
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00883530
Message ID:
00883541
Views:
12
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform