Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How detect if in compiled EXE or running as developer? 2

Status
Not open for further replies.

dbMark

Programmer
Apr 10, 2003
1,515
US
I've looked in the command set and also here in the search section, but I don't see an easy simple way to detect in my code whether the program is running as a compiled application using the run-time DLLs or in developer mode such as when I press the "Run" button in the project box?

Surely someone's asked this before? (I've checked out SET"("DEVELOPMENT") but that's just a setting to tell the program whether to verify the compiled code is current.)
 
Use the VERSION(2) function to determine which version of FoxPro is running. This returns 0 for RunTime, 1 for Standard, and 2 for Professional.

You can also use this to determine if a certain window is open and disallow another instance:

DECLARE INTEGER FindWindow IN user32;
STRING lpClassName,;
STRING lpWindowName

** put this in main prg
IF findwindow(null,"Untitled - Notepad") = 0
DO myprog && OR HAVE CODE TO LAUNCH FORM ETC.
ELSE
RETURN
ENDIF

Regards,

Rob
 
_VFP.StartMode && RETURNS 0 - DEV MODE, 4 - RUNTIME
VERSION(2) && RETURNS 1 or 2 - DEV MODE, 0 - RUNTIME



Regards,

Rob
 
Thanks, everyone! I'd checked all the SYS() commands but didn't consider VERSION().
 
Hi,

VERSION(2) may be sufficient for your case, but _VFP.startmode gives much more information, eg. if foxpro is run as IDE, via COM automation (VisualFoxpro.Application), as an out-of-process exe COM server, as an in-process DLL COM server, as distributable APP or EXE or as in-process DLL for multithreaded use.

And the VFP system variable has much more interesting properties to offer.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top