Automating tasks in Visual C++ By Macro

[MSDN]

Objects and the Object Hierarchy

Home Page (Objects)OverviewFAQReference

You can control the Visual C++ Developer Studio environment programmatically by manipulating it through Automation (formerly OLE Automation). For example, in a VBScript macro, you can control an open document by manipulating its corresponding Document object.

Each Developer Studio object implements a dual interface through which you can manipulate the object. Each object implements an IDispatch interface for Automation and a Component Object Model (COM) interface for direct access to object members (properties, methods, events).

Add-ins written in Visual C++ versions 5.0 or later, or Visual Basic versions 4.0 or later can employ early binding by using the COM interface. Early binding makes all calls into interface members faster at run time.

Overview of Each Developer Studio Object

Each Developer Studio object is described below.

Object Represents
Application The Developer Studio (environment for Visual C++) application.
Breakpoint A breakpoint, which is used for debugging purposes.
Breakpoints All the breakpoints set during a Developer Studio session.
BuildProject A project that contains build (configuration) information.
Configuration A set of settings to use for building a project.
Configurations All configurations in a project.
Debugger Enables you to inspect the execution of processes in the application in Developer Studio.
Document An open document.
Documents All open documents; a collection of one or more Document and TextDocument objects.
Project A group of related files.
Projects All projects in the currently open workspace.
TextDocument An open text file.
TextEditor The Developer Studio text editor.
TextSelection Selected text in an open text document.
TextWindow A view of an open text file.
Window A multiple document interface (MDI) client window in which a document is being edited.
Windows A collection of windows; all open windows.

The Developer Studio Object Hierarchy for Automation

To manipulate Developer Studio objects, you must know the relationships between them. The Application object is at the top, and the other objects are subordinate to it. This relationship allows you to directly access objects subordinate to the Application object by using the properties and methods of the Application object.

The "has-a" tree is shown below. For example, the Breakpoints object has, as one of its properties, a Breakpoint object.

Application
   Application (Application is its own parent)
       Projects
           Project
               Configurations
                   Configuration
                       Configurations (circular)
       Documents
           Document
               Window (for "Generic" window types)
           TextDocument
               TextSelection
               TextWindow
               Window (for "Text" window types)
       TextEditor
       Windows
       Debugger
       Breakpoints
           Breakpoint

你可能感兴趣的:(task)