Article ID: 118819 - Last Review: July 13, 2004 - Revision: 2.1 How To Tell Whether an App Runs in VB Design EnvironmentThis article was previously published under Q118819 On This PageSUMMARY
This article describes how a Visual Basic application can determine whether
it is running in the design environment or as an executable file. Two ways
that Visual Basic does this are explained.
MORE INFORMATION
Visual Basic provides the APP object, which has the property EXENAME.
APP.EXENAME reports the name of the executable file when it runs as an
executable file. However, in the design environment, APP.EXENAME reports
the name of the project. If you use different names for the project and the
executable file, then you can use APP.EXENAME to determine whether an
application is running in the Visual Basic design environment or as an
executable file.
You can also use the Windows API to determine whether an application is running in the Visual Basic Design Environment or as an executable file. When running in the design environment, the application's module name is "VB." However, as an executable file the module name matches the executable file name that is chosen when compiling the application to an executable file from Visual Basic. ExampleYou can determine the module name by using the functions GetCurrentTask() and TaskFindHandle() from the Windows API. The following example illustrates how to use the functions to determine whether the application is running in the Visual Basic design environment:
Notes
| Article Translations
|

Back to the top
