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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IDE mode and EXE Mode

Status
Not open for further replies.

Maii

Programmer
Aug 28, 2003
54
BD
Hi,
Is there any property/Method to distinguish where app is running from source code or EXE?
Thanks in advance
maii
 
I use this routine (don't remember who to credit it to - doh!):

Public Function IsDebugMode(Optional bSetMode As Boolean = False) As Boolean

Static DebugMode As Boolean
DebugMode = bSetMode
If Not DebugMode Then Debug.Assert IsDebugMode(True)
IsDebugMode = DebugMode

End Function

I've seen others that check for the name of the program, use debug.print 1/0 (divide by zero) and trap the error, but this one will work properly even with trapping all errors mode selected (the divide by zero won't) in the IDE.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
I tend to use the following. Not sure why you would want to but you can simulate debug mode when running the exe (C:\Project1.exe -DEBUG)

In the project/properties/make set a command line argument say -DEBUG

Code:
'In a code module:-

Public IsDebugMode As Boolean

'In main or startup form:-

IsDebugMode = IIf(InStr(Command, "-DEBUG") > 0, True, False)
    
'As required:-
If IsDebugMode Then MsgBox "debug.mode"


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top