Application Object

Home Page (Objects)OverviewFAQReference

The Application object represents Developer Studio and is the topmost object in the Developer Studio object hierarchy. From the Application object, you can directly access other Developer Studio objects by using the Application object's properties and methods, or you can indirectly access objects through other objects obtained by these properties and methods.

The Application object has the following properties, methods, and events:

Properties
Active Name
ActiveConfiguration Parent
ActiveDocument Path
ActiveProject Projects
ActiveWindow TextEditor
Application Top
CurrentDirectory Version
Debugger Visible
Documents Warnings
Errors Width
FullName Windows
Height WindowState
Left

Methods
AddCommand ExecuteCommand
AddCommandBarButton ExecuteConfiguration
AddKeybinding GetPackageExtension
AddProject PrintToOutputWindow
Build Quit
Clean RebuildAll
EnableModeless SetAddInInfo

Events
BeforeApplicationShutDown NewDocument
BeforeBuildStart NewWorkspace
BeforeDocumentClose WindowActivate
BuildFinish WindowDeactivate
DocumentOpen WorkspaceClose
DocumentSave WorkspaceOpen

Because the Application object is the topmost object, its name is implied when you access its properties and methods. Accordingly, you only need to specify its property or method names. For example, to access the Quit method, you only need to specify Quit — not Application.Quit.

Using a Dual Interface to Access This Object

This section about dual interfaces is useful for writing add-ins or automating Developer Studio across processes. This section is not applicable to writing VBScript macros.

The Application object implements the IApplication dual interface. Through this interface, add-ins can directly access the members (properties, methods, and events) of this object and can employ early binding to make calls into these members faster at run-time.

Add-ins written in Visual C++ can access members of the Application object by using the header files in Vc98\Include\objmodel. However, if you use the Developer Studio Add-in Wizard to create an add-in, the wizard automatically includes these header files in your source code.

The following header files are used for the Application object:

appauto.h Declares the dual interfaces.
appguid.h Declares the GUIDs used to identify the interfaces.
appdefs.h Declares additional information needed to use the interfaces, such as error IDs and enumerated constants.

Add-ins written in Visual Basic can access members of the Application object by using the Shared Objects type library, located in msdev98\bin\devshl.dll.

Note   In the Visual Basic References dialog box (Project menu, References command), the names of the type libraries begin with "Visual C++ 6.0" for Visual C++ version 6.0. For Visual C++ version 5.0, the names begin with "Visual Studio '97."