1.Open the add-in's project.
2.In ClassView, expand the project's classes.
3.Select the ICommands interface, and then click the right mouse button.
4.Click the Add Method command.
5.In the Method Declaration box, enter the method that specifies what the command is supposed to do.
6.In ClassView, expand the CCommands class, and then double-click the method name.
7.In the Commands.cpp file, write the code for the method.
8.In ClassView, expand the CDSAddIn class.
9.Double-click the OnConnection method.
Search for code that adds a command. This code calls the AddCommand method.
10.For the new command, copy and customize the AddCommand call.
11(可选向工具条上加按扭).Optionally, provide a toolbar button the user can press to carry out the command. If you used the Developer Studio Add-in Wizard and selected the Provides a toolbar option, then the wizard generated the code needed to provide a button. However, if you didn't select that option, you must add the necessary code. For details, see Creating Toolbar Buttons for Add-in Commands Programmatically.
12(可选向按扭上加图片).Optionally, create an image for the toolbar button. If you used the Developer Studio Add-in Wizard and selected the Provides a toolbar option, then the wizard automatically created an image for the button. For details, see Creating Images for Toolbar Buttons.
13.(可选新增快捷键)Optionally, assign a key sequence to the command. For details, see Assigning Key Sequences to Add-in Commands_Programmatically.

本文介绍如何在Visual Studio加载项项目中扩展命令功能,包括添加新命令、为命令创建按钮及图标,以及设置快捷键等步骤。
653

被折叠的 条评论
为什么被折叠?



