Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Development Mode
Message
From
16/10/2020 06:32:36
 
 
To
16/10/2020 05:46:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01676646
Message ID:
01676692
Views:
37
What would give the correct information is the following line of code in the main entry prg, but the problem would be to make this available for the application.
llDevMode = JUSTEXT(SYS(16)) == "FXP"

Although it's somewhat safer than VERSION(2), as Thomas pointed out, you can change the value in the debugger when running the executable. Using Strings.exe you can find probably all variable names you would suspect, so if someone were looking for it, he would find it.

Most secure would be what Thomas suggested, to create a constant which is set by the compiler when building the release executable. But I don't like constants too much, because you need to include the .h file in all places in the code. As an alternative, perhaps best to implement a class that encapsulates a string that is obfuscated.

>Christian,
>now you change your question dramaticaly.
>Indeed in your case the exe is not running in normal development.
>Must think how to find a solution for this question.
>Stay healthy,
>Koen
>
>>What I was trying to say was actually, that the user could run your executable in devmode, if he has VFP installed and runs the exe from the VFP IDE. In this case the executable is not running in your normal development environment, but Version(2) would indicate "devmode" incorrectly. That would be a security risk, because often in devmode we would expose information or processes that should not be availble to the end user.
>>
>>Version(2) basically tells you that the VFP IDE is present, but it does not tell you if you are starting the program as developer from source code.
>>
>>
>>>Christian,
>>>you are testing wrongly. You are still in development mode.
>>>Instead of typing 'Do sample.exe' in your command window, you should quit VFP and run the sample.exe by clicking the fox.icon which you will find, by default in your directory where sample.exe is created or clicking the shortcut.icon on your desktop. Than you are in run time.
>>>Stay healthy,
>>>Koen
>>>
>>>>That is indeed very strange. See attached image, if I start the exe from VFP ide, it shows Devmode = .T.
>>>>
>>>>I tested this on different locations, also different VFP 9. Servicepacks. Which version are you using?
>>>>
>>>>>Christian,
>>>>>I made the following test:
>>>>>
>>>>>ln = Version(2)
>>>>>If ln = 2
>>>>>	Messagebox( Transform(m.ln), 0+16+0, "Title", 0 )  
>>>>>	? Set('path')
>>>>>Else	
>>>>>	Messagebox( Transform(m.ln), 0+16+0, "Title", 0 )  
>>>>>Endif
>>>>>
>>>>>
>>>>>When I now start my .pjx file ln=2, when I start the exe ln shows 0
>>>>>Stay healthy,
>>>>>Koen
>>>>>
>>>>>
>>>>>>I did the test with the following result:
>>>>>>1) Running exe by double click:
>>>>>>
>>>>>>llDevMode = ".FXP" $ SYS(16)
>>>>>>MESSAGEBOX(m.llDevMode) && .F.
>>>>>>MESSAGEBOX(VERSION(2)) && 0
>>>>>>
>>>>>>
>>>>>>2) Starting exe from VFP command window (Do ..exe)
>>>>>>
>>>>>>llDevMode = ".FXP" $ SYS(16)
>>>>>>MESSAGEBOX(m.llDevMode) && .F.
>>>>>>MESSAGEBOX(VERSION(2)) && 2
>>>>>>
>>>>>>
>>>>>>>Christian,
>>>>>>>I dont think your remark, quote you can start the exe from any VFP Command window typing DO MyVFPExe.Exe. Then it starts the program as usual, but VERSION(2) will indicate that you are running in developer mode. unquote.
>>>>>>>The moment your start the exe, wether you start it in the usual way by clicking the icon and or shortcut or by activating the exe via the line 'Do MyVFPExe.exe' you are NOT in development mode. Please make a small test and you will see.
>>>>>>>Stay haelthy,
>>>>>>>Koen
>>>>>>>
>>>>>>>>What I meant was, that instead of starting the exe directly (as the user typically does by double click on the shortcut), you can start the exe from any VFP Command window typing DO MyVFPExe.Exe. Then it starts the program as usual, but VERSION(2) will indicate that you are running in developer mode.
>>>>>>>>
>>>>>>>>So any person can run your program as developer if that is what you are looking at.
>>>>>>>>
>>>>>>>>Probably safest way would be to create a constant or public variable that you switch during compiling the release executable.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>Christian,
>>>>>>>>>not 100% clear what you are trying to tell here,
>>>>>>>>>do you mean that you had a x=verstion(2) in your exe and upon that it installed the (complete) VFP,IDE on that pc?
>>>>>>>>>That is certainly not usual, the piece of code I gave here is part of all my .exe and I never ever had that result as you describe, so I must conclude I do misinterpreted your remark, would you be able to clearify>
>>>>>>>>>Stay healty,
>>>>>>>>>Koen
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>I once tested version(2) and could run an EXE file from VFP IDE (DO test.exe) and it would return Version(2) = 2 (development mode). So a client could run the exe in devmode with that approach if he installs VFP IDE.
>>>>>>>>>>
>>>>>>>>>>>Hi,
>>>>>>>>>>>Apart from Tore's usefull correct information there is also version() , if version(2) is returning 2 you are in development if version(2) returns 0 you are in Run time.
>>>>>>>>>>>usufull if you want to have 2 different settings of your path depending on the version.
>>>>>>>>>>>e.g.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>Set Path To []
>>>>>>>>>>>? SET('path')
>>>>>>>>>>>*** Go ahead and set the path
>>>>>>>>>>>If Version(2) # 0
>>>>>>>>>>>	***  We are in Development Mode
>>>>>>>>>>>	***  Set up Project search path
>>>>>>>>>>>	m.lcPath = Home() + ';' + Fullpath( Curdir() ) + [Class;  Data; Forms; Images ; Menu; Progs ; Reports; ReportingFiles]
>>>>>>>>>>>
>>>>>>>>>>>Else
>>>>>>>>>>>	*** We are in Production Mode
>>>>>>>>>>>	*** Set up application search paths
>>>>>>>>>>>	m.lcPath = Fullpath( Curdir() ) + [ ;Reports ; ReportingFiles]
>>>>>>>>>>>Endif
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>Stay healthy,
>>>>>>>>>>>Koen
>>>>>>>>>>>>I'd like to bypass code while in development mode only.
>>>>>>>>>>>>
>>>>>>>>>>>>I'm fairly certain there's a way VFP knows it's running under development mode as opposed to running the EXE.
>>>>>>>>>>>>
>>>>>>>>>>>>Any help?
>>>>>>>>>>>>
>>>>>>>>>>>>Thanks,
>>>>>>>>>>>>Rich Murillo
Christian Isberner
Software Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform