Format Source Code within Visual C++ / Visual Studio
The following instructions allow you to format source code files in Visual C++ 6
using FormatCode Code Formatter command line tool. We used Visual C++ 6 of Visual Studio 6, so if you use an older
or even a newer version then several screenshots or menu items may differ from our description.
Add a tool action that will invoke FormatCode within VC++ 6
1. Click "Tools" -> "Customize".
2. In the "Tools" page, click "Add" button, and enter "FormatCode".
3. Type an ampersand before one of the letters in the tool name to create an accelerator key for the command when it appears on the Tools menu. For example, if you use "&FormatCode", the letter 'x' will be the accelerator key.
4. In the "Command" box, enter the path to FormatCode.exe, or choose Browse to navigate to it.
5. Fill in the form as show below: (Assuming you installed FormatCode in C:\Program Files\FormatCode\)
- Title: &FormatCode
- Command: C:\Program Files\FormatCode\FormatCode.exe
- Arguments: $(FilePath)
- Initial directory: $(FileDir)
Add a keymapping so you can invoke FormatCode using Ctrl+Alt+T
1. In the "Keyboard" page, choose "Tools" in "Category" list box.
2. In the "Commands" list box, type "UserTool1".
3. Place the cursor in the "Press new shortcut key" text box, and then press Ctrl+Alt+T to assign it to FormatCode.
4. Click "Assign", then click "Close" to save settings.
You may now invoke FormatCode command line tool two ways:
1. Using Ctrl+Alt+T.
2. By clicking "Tools" -> "FormatCode".
With FormatCode Code Formatters, you can format and transform any foreign source code to meet your favourite coding style within Visual Studio in several seconds!