Microsoft KB Archive/201177

= INFO: Visual Studio Macros for MFC and ATL Source Code =

Article ID: 201177

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft ActiveX Template Library 3.0 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li> Microsoft Visual C++ 6.0 Enterprise Edition</li> Microsoft Visual C++ 6.0 Professional Edition</li> Microsoft Visual C++ 6.0 Standard Edition</li></ul>

-

<div class="notice_section">

This article was previously published under Q201177

<div class="summary_section">

SUMMARY
Opening an SDK or Visual C++ header, or source file can be a tedious task as it often requires typing the full Visual C++ installation path (C:\Program Files\Microsoft Visual Studio\VC98) followed by the directory that you are interested in (include, atl\include, mfc\src, and so forth).

<div class="moreinformation_section">

MORE INFORMATION
The Visual Studio macros included in this article reduce this typing to a keystroke sequence or button press. These macros open a File Open dialog box with the directory set appropriately. For example, running the macro ATLInclude below invokes the File Open command with the directory set to the ATL Include directory.

These macros are handy when attached to a tool bar button in the Visual C++ Integrated Development Environment (IDE). '- ' FILE DESCRIPTION: Macros for opening MFC/ATL Source files. ' - Change the BaseDir settings for your installation '-- BaseDir ="C:\Program Files\Microsoft Visual Studio\VC98\"

Sub Include 'DESCRIPTION: Open VC Include dir OpenDir "include" End Sub

Sub ATLInclude 'DESCRIPTION: Open ATL Include dir OpenDir "ATL\include" End Sub

Sub ATLSrc 'DESCRIPTION: Open ATL Source dir OpenDir "ATL\src" End Sub

Sub MFCInclude 'DESCRIPTION: Open MFC Include dir OpenDir "MFC\include" End Sub

Sub MFCLib 'DESCRIPTION: Open MFC Library dir OpenDir "MFC\lib" End Sub

Sub MFCSrc 'DESCRIPTION: Open MFC Source dir OpenDir "MFC\src" End Sub

Private Sub OpenDir(dir) OriginalDir = CurrentDirectory CurrentDirectory = BaseDir + dir ExecuteCommand "FileOpen" CurrentDirectory = OriginalDir End Sub Follow these steps to create a toolbar item out of one of these macros:
 * 1) From the Tools menu in the IDE, click Customize.
 * 2) On the Commands tab, select Macros from the Category drop-down list box.
 * 3) Drag-and-drop the macro from the Commands list onto an existing toolbar or into blank space in the IDE.
 * 4) Select an image from the pop-up Button Appearance dialog box and click OK.

<div class="references_section">