Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Equivalent of SYS(16)
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00090128
Message ID:
00090148
Views:
20
>Hi,
>
>I'm writing a small "splash screen" app using Borland C++ Builder.
>
>It works quite well, but I'd like to defend the exe against a user installing my exe in another directory and trying to run it.
>
>What I'd like a a procedure in C++ or the Windows API which returns the same information which I get with SYS(16) in Visual FoxPro, so that I can ascertain the location of the exe which is running (the splash screen) and thus find the location of my Visual FoxPro exe (which will be in the same directory).
>
>Using the current directory won't necessarily work, as the user could run my exe from a Windows NT command prompt
>
>i.e. C:\myappdir\myapp.exe.
>
>Best
>
>Matt.

If you're registring the VFP app, you could always check the registry for the default directory. There's a class that comes with VFP for accessing it, as well (I believe) a file for downloading from here.

Otherwise, you could use:
DECLARE INTEGER GetCurrentDirectory IN Win32API;
  INTEGER nBufferLength, STRING @lpBuffer
lcbuffer = SPACE(200)
lnbuflen = LEN(lcbuffer)
lnbuflen = GetCurrentDirectory(lnbuflen, @lcbuffer)
This will return the current working directory of the application.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform