目前学习C/C++,我常用的几个IDE:VC++6.0,DEV C++,visual studio。比较频繁的操作是 多行加注释。
每个IDE的快捷键不同,
而在VC6.0中没有自带的快捷键,需要自行设置。
百度了一下设置方法,如下。
这里,我们用VBScript脚本来添加这个功能。
'------------------------------------------------------------------------------
'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
【转自 https://www.cnblogs.com/qiulidong/p/11736982.html】