slide1 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Automating Visual C++ IDE using Add-ins and Macros Ranga Narasimhan Microsoft Developer Support Microsoft Corporation PowerPoint Presentation
Download Presentation
Automating Visual C++ IDE using Add-ins and Macros Ranga Narasimhan Microsoft Developer Support Microsoft Corporation

Loading in 2 Seconds...

play fullscreen
1 / 21

Automating Visual C++ IDE using Add-ins and Macros Ranga Narasimhan Microsoft Developer Support Microsoft Corporation - PowerPoint PPT Presentation


  • 1090 Views
  • Uploaded on

Automating Visual C++ IDE using Add-ins and Macros Ranga Narasimhan Microsoft Developer Support Microsoft Corporation Scope of the Presentation Brief introduction to automation Overview of Microsoft ® VC++ ® IDE automation Various methods of automating VC++ IDE

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Automating Visual C++ IDE using Add-ins and Macros Ranga Narasimhan Microsoft Developer Support Microsoft Corporation' - ostinmannual


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1

Automating Visual C++ IDE using Add-ins and MacrosRanga NarasimhanMicrosoft Developer SupportMicrosoft Corporation

scope of the presentation
Scope of the Presentation
  • Brief introduction to automation
  • Overview of Microsoft® VC++ ® IDE automation
  • Various methods of automating VC++ IDE
  • Overview of add-ins and macros
  • Debugging add-ins and macros
  • Customizing the VC++ IDE
overview automation
Overview: Automation
  • Automation is based on COM
  • Automation makes it possible for one application to manipulate objects implemented in another application, or to "expose" objects so they can be manipulated
  • Automation can be performed by a program written using COM-aware language, for example, VC++, Microsoft® Visual Basic® (VB), and so on
overview vc automation
Overview: VC++ Automation
  • VC++ is an automation server
  • VC++ automation can be used to extend the capabilities of VC++
  • You can automate VC++ using any language that supports COM. Developers normally use VBScript, VC++, and VB
vc automation history
VC++ Automation History
  • Automation was first introduced with VC++ 5.0 IDE
  • VC++ 6.0 fixed some major bugs and introduced some new methods (BuildProject.AddFile)
  • VC++ 6.0 also introduced the “Quick Macro” feature
  • See “Microsoft Visual C++ 6.0 Migration Guide” topic on MSDN for more information on the new VC++ 6.0 features
object model overview
Object Model Overview
  • Provides 17 objects
  • Objects provide methods and properties
  • The Application and Debugger objects provide events
vc automation support
VC++ Automation Support
  • VBScript macro
  • Add-ins (DLL) written using VC++, VB, or any other language that supports COM
  • Automation clients (EXE or DLL) written using VC++, VB, or any other language that supports COM
  • Remote automation through DCOM
add ins macros
Add-ins Macros
  • Written in VC++, VB, and so on
  • Can access local computer resources besides object model
  • Access Win32® API
  • Early bound
  • Can control another EXE
  • Written in VBScript
  • Can access the object model and some other COM objects
  • Cannot access Win32 API
  • Late bound
  • Cannot control another EXE
creating a macro file
Creating a Macro File
  • In VC++ IDE, on the File menu, click New.
  • Click the Files tab.
  • Select “Macro File” and give it a name.
  • This will create an empty macro (DSM) file where you can start typing code:

Sub Test()

MsgBox “Hello World”

End Sub

recording a macro
Recording a Macro
  • Another method of creating a macro is by recording.
  • On the Tools menu, click Macro, and then click Record.
  • You will have to give it a macro name (description is optional).
  • The recording starts immediately and the actions that you perform are recorded.
  • On the Tools menu, click “Stop Recording” to stop recording the macro.
creating add ins
Creating Add-ins
  • To create a VC++ add-in use the “DevStudio Add-in Wizard.” You have an option to include toolbars and event handling in Step 1 of 1.
  • To create a VB add-in, use the VB 5.0 add-in sample shipped with the MSDN Library.
  • You can definitely write an add-in using a language that supports COM.
how are add ins implemented
How Are Add-ins Implemented ?
  • Implement the IDSAddin interface. This will connect and disconnect the add-in with VC++
  • Implement an ICommand interface that DevStudio will use to call your add-in methods
  • Provide implementation for IApplicationEvents and IDebuggerEvents for event handling (optional)
  • You are not limited to VC++ and VB for add-in implementation
installing add ins and macros
Installing Add-ins and Macros
  • On the Tools menu, click Customize.
  • Click the “Add-ins and Macro files” tab.
  • Click the Browse button and locate the DSM (Macro) or DLL (Add-in) file.
  • If it is installed properly, you’ll see a check mark against the macro/add-in.
  • Click the Close button.
calling add in and macro commands
Calling Add-in and Macro Commands
  • If you have one or more command buttons associated with your macro and/or add-in commands, click those buttons.
  • You can also start them from the command line:

Msdev.exe -ex command name

  • Call them from another add-in and/or macro using the Application.ExecuteCommand method
debugging
Debugging
  • To debug macros, you should use the PrintToOutputWindow or MsgBox method
  • To debug add-ins, you will have to specify Msdev.exe as the executable for the debug session because it’s a DLL
customizing the vc ide
Customizing the VC++ IDE
  • On the Tools menu, click Customize.
  • Click the Commands tab.
  • Under Category, click Add-ins or Macros.
  • Drag the icon listed in the Buttons group to the location you want.
some limitations and known problems
Some Limitations and Known Problems
  • Macro names cannot have an underscore. It is reserved for event procedures.
  • You cannot pass arguments to add-in and macro commands.
  • You cannot start multiple add-in and macro commands.
  • You can add a project, but cannot remove a project.
  • You cannot change the output filename for static library project.
useful articles
Useful Articles
  • Q247035 “HOWTO: Automate Visual C++”
  • Q231636 “HOWTO: Controlling the Visual C++ IDE Source Code Editor Window”
  • Q237870 “HOWTO: Increment Version Information After Each Build in VC++”
  • Q248130 “FILE: AutoSave.exe Provides AutoSave for Visual C++”
references
References
  • “Extend Developer Studio 97 with Your Own Add-ins, Macros, and Wizards,” Steve Zimmerman (MSJ, 9/97)
  • “Extending Developer Studio with Add-ins,” Richard Grimes (MSDN Library)
  • Automated Builds in DevStudio, or the Night Build Scenario
  • “Enhancing the Visual C++ 5.0 Workplace with VBScript Macros” by Mark Davis
  • “VBScript Language Reference” topic in the MSDN Library