Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Equivalent of SYS(16)
Message
From
08/04/1998 13:26:23
Raul Davila
Davila Programming Services
Toa Alta, Puerto Rico
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00090128
Message ID:
00090518
Views:
25
>>>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.
>>>
>>Hi Matt:
>>
>> GetModuleFileName will give you the exact path of exe.
>>
>> DWORD GetModuleFileName(
>> HMODULE hModule, // handle to module to find filename for
>> LPTSTR lpFilename, // pointer to buffer for module path
>> DWORD nSize // size of buffer, in characters
>> );
>>
>> You can use it in the splash screen exe and look for the VFP app in tha directory.
>>
>Raul,
>I happen to be searching for EXACTLY the same solution as Matt here, I want to display the compile date/time of the exe and need to find it first using equivalent of SYS(16). The solution you provide (without testing) looks as if it needs the file to be opened to offer a handle to the function. Problem: you need to know where the file is stored to open it. I think Matt's problem is the same as mine - what if the exe is somewhere in the path list and the user runs it from a command window. It is not in the current directory, nor current working directory.

Let's see if I understood the original.
You want to be able, from inside the splash screen .exe, to find if it is in the same directory as the VFP app. If it's not in the same place the don't run.

If that is the case GetModuleFileName() is the way to go.
GetModuleFileName() will give you the "exact" path to the splash screen .exe, when called from inside the splash screen .exe, then you just have to search for the VP app there and if not found exit the splash screen.
R. Davila
DBA / Network Administrator
Administracion de Fomento Comercial
Gobierno de Puerto Rico

Still waiting for FoxPro for LINUX
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform