Article ID: 177636 - Last Review: June 29, 2004 - Revision: 3.1 How To Check If Program Is Running in the IDE or an EXE FileThis article was previously published under Q177636 On This PageSUMMARY
This article demonstrates how to determine if your program is running in the Visual Basic integrated development environment (IDE) or as a compiled
executable file. You might want to check where your program is running if
you need to add debugging information that would not be visible in the
compiled version of your program.
MORE INFORMATION
There are two methods you can use to determine if your program is running
from the IDE or the EXE.
Method 1: EXE File Name Differs from Project NameThe App object contains general information about the program, such as the executable file name. If the project name and the compiled version of the project have different file names, then you can use the App.EXEName property to determine if the EXE is running or if your project is running in the IDE. If the program is running from the Visual Basic IDE, the EXEName property returns the project name. When a program is running from an executable, the EXEName property contains the EXE file name.Method 2: EXE File Name and the Project Name Are the SameIf the project name and the compiled version share the same name, then use the GetModuleFileName API function to determine if your program is running from the IDE or from a compiled version. GetModuleFileName retrieves the full path and filename for the executable file containing the specified module. If the function returns a path to the Visual Basic file, VB5.EXE, then the program is running in the IDE. Otherwise, the program is running from an executable file.GetModuleFileName requires the following arguments:
Sample Project
REFERENCES
For information about determining if a 16-bit Visual Basic application is
running in the design environment, please see the following article in
the Microsoft Knowledge Base:
118819
(http://support.microsoft.com/kb/118819/EN-US/
)
: How To Tell Whether an App Runs in VB Design Environment
APPLIES TO
| Article Translations
|
Back to the top
