How do I determine in the code whether or not my project is running compiled or not.
Printable View
How do I determine in the code whether or not my project is running compiled or not.
Well, if it's compiled, than there should be an exe file.
Here is the code to determine if it exists:
Or do you want to check to see if your program is already running?Code:If Dir(App.Path & "\" & App.EXEName & ".exe") <> "" Then
Msgbox "Project has been compiled"
Else
Msgbox "Project has not been compiled"
End If
Code:If App.PrevInstance Then
MsgBox App.Title & " is already running!
End
Exit Sub
End If
There is a way to determine whether the app is running in the development environment. I just can't remember where i got the info from. I will look and post back if i find the code.
Later
REM
There is no such thing is App.IsRunningInIDE
But a while ago someone posted something like
Debug.Print 1 / 0
In the IDE this will cause a "division by zero" error. In the exe it won't since debug statements are not compiled.
However, I think this is *very* crappy, if you want certain code only be executed in the IDE (or only in the exe) just put some conditional compiler constants in the project properties (eg. DEBUG = 1)
and check it in your code like
#If DEBUG Then
' will only be executed when DEBUG = 1, else it will be ignored
#End If