怎么样在VC++6.0中添加和取消批量注释的功能
首先打开VC++6.0,选择“文件”,然后选择要新建的文件类型。并给文件起名字设置文件要保存的位置,如下图:

单击“OK“后,填写相应的描述,如下图:

单击“OK”,然后输入代码,单击保存后,关闭vc++6.0。如下图:

Sub SetSelNote()'Sun DESCRIPTION: 过程SetSelNote 用于将选中的文本转换为注释 dim CurWin
'当前获得的窗口 set CurWin = ActiveWindow if CurWin.type<>"Text" Then
'判断当前窗口是否是文本窗口 MsgBox "当前窗口不是代码窗口" else NoteType = "//"
BeginLine = ActiveDocument.Selection.TopLine EndLine =
ActiveDocument.Selection.BottomLine if EndLine < BeginLine
then Line = BeginLine BeginLine = EndLine EndLine =
Line else for row = BeginLine To EndLine
ActiveDocument.Selection.GoToLine row
ActiveDocument.Selection.SelectLine'选中当前行 ActiveDocument.Selection =
NoteType + ActiveDocument.Selection Next End if End ifEnd
Sub
Sub CancelSelNote() dim CurWin '当前获得的窗口 set
CurWin = ActiveWindow if CurWin.type<>"Text" Then
'判断当前窗口是否是文本窗口 MsgBox "当前窗口不是代码窗口" else BeginLine =
ActiveDocument.Selection.TopLine EndLine =
ActiveDocument.Selection.BottomLine if EndLine < BeginLine
then Line = BeginLine BeginLine = EndLine EndLine =
Line else for row = BeginLine To EndLine
ActiveDocument.Selection.GoToLine row
ActiveDocument.Selection.SelectLine'选中当前行 SelBlock =
ActiveDocument.Selection Trim(SelBlock) pos =
instr(SelBlock,"//") if pos <>0 then RightBlock =
Right(SelBlock, Len(SelBlock)-2) ActiveDocument.Selection =
RightBlock End if Next End if End ifEnd
Sub这样在你刚才设置的位置就生成了一个.dsm文件,如下图:

打开一个C++工程,按照图片中的操作选择 Tool(工具)——>Customize(定制)。如下图:

选择Add--ins and Macro File(附加项和宏文件),选择刚才制作的文件Node.dsm,如下图:

勾选上Node,如下图:

选择命令, 在 类别 中选择Macros ,如下图:


将鼠标按住 SetSelNote,将其拖到工具栏中,会弹出下面的对话框:

从这里面随便选一个你喜欢的图标,单击OK,用于做“批量注释”的图标
CancelSelNote的做法与SetSelNote一样。
最后在工具栏中,就出现了你自己定义的批量注释和消除批量注释的图标了。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:114
阅读量:89
阅读量:175
阅读量:67
阅读量:42