VC6.0添加&消除批量注释

VC6.0如何设置多行注释快捷键?
这里,我们用VBScript脚本来添加这个功能。

1.首先,打开VC++6.0,选择File->New->Macro file。
2.点击确定,填写相应的描述。

 

3.输入代码,点击保存,关闭VC++6.0。(代码见后面)

这样就在文件夹中生成了一个 .dsm 文件。

4.打开一个C++文件,tools->customize。
5.选择 Add-ins and Macro Files -> Browse选择node.dsm。

 

 6. 勾上node。
7. 选择 Command -> Category ,选择 Macros 。
8. 将 鼠标 按住 SetSelNote ,将其拖到工具栏中,会弹出下面的对话框。
9. CancelSelNote的做法与SetSelNote一样。
10.最后在工具栏中,就出现了你自己定义的批量注释和消除批量注释的图标了。


文中的代码:
'------------------------------------------------------------------------------
'FILE DESCRIPTION: 为开发环境添加批量注释或取消注释
'------------------------------------------------------------------------------

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 if
End 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 if
End Sub
————————————————
版权声明:本文为CSDN博主「better *man」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44659133/article/details/105640434

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值