设为首页 加入收藏

TOP

为VC++6.0 添加批量注释和批量取消注释 vcscript脚本
2014-11-23 17:45:00 】 浏览:9507
Tags:6.0 添加 批量 注释 取消 vcscript 脚本

[plain]
'------------------------------------------------------------------------------
'FILE DESCRIPTION: 为开发环境添加批量注释或取消注释
'------------------------------------------------------------------------------
Sub SetSelNote() 'Sun DESCRIPTION:过程SetSellNote用于将选中的文本转换为注释
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
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇VC++中ADO方式操作数据库之有关“.. 下一篇[VC编程技巧]文件☞2.1EOF的..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目