放牧代码和思想
专注自然语言处理、机器学习算法
    恕不接待索要源码语料者、索求技术方案者、以及不Google的懒人。

在VC中快速加入注释的宏

‘——————————————————————————
‘FILE DESCRIPTION: 函数注释,类注释,文件注释 可以在工具->宏->击键中加入快捷键
‘——————————————————————————
Sub FullScreen()
‘DESCRIPTION: 全屏编辑
    ExecuteCommand "ToggleFullScreen"
End Sub

Sub AddHeadDesc()
‘DESCRIPTION: 添加一个标准的头文件说明
    ActiveDocument.Selection.StartOfDocument
    DefaultUserName = "hankcs"
    Dim FileName
    FileName = ActiveDocument.Name
    ActiveDocument.Selection = "/*******************************************************************" +_
                        vbLF + " 文件名        :" + FileName +_
                        vbLF + " 创建者        :" + DefaultUserName +_
                        vbLF + " 创建时间    :" + CStr(Now) +_
                        vbLF + " 功能描述    :" +_
                        vbLF + "              " +_
                        vbLF + " ******************************************************************/" +_
                        vbLF
    ActiveDocument.Selection.LineUp flase, 3
    ActiveDocument.Selection.EndOfLine
End Sub

Sub AddClassDesc()
‘DESCRIPTION: 添加类注释
    Dim ClassName
    ClassName = ActiveDocument.Selection.Text
    ActiveDocument.Selection.StartOfLine
    ActiveDocument.Selection = "/******************************************************************" +_
                        vbLF + " 类名        :" + ClassName +_
                        vbLF + " 创建时间    :" + CStr(Now) +_
                        vbLF + " 功能描述    :" +_
                        vbLF + "              " +_
                        vbLF + " ******************************************************************/" +_
                        vbLF
    ActiveDocument.Selection.LineUp flase, 3
    ActiveDocument.Selection.EndOfLine
End Sub

Sub AddMethodDesc()
‘DESCRIPTION: 添加函数注释
    Dim MethodName
    MethodName = ActiveDocument.Selection.Text
    ActiveDocument.Selection.StartOfLine
    ActiveDocument.Selection = "/******************************************************************" +_
                        vbLF + " 函数名        :" + MethodName +_
                        vbLF + " 参数        :" +_
                        vbLF + " 返回值        :" +_
                        vbLF + " 功能描述    :" +_
                        vbLF + "              " +_
                        vbLF + " ******************************************************************/" +_
                        vbLF
    ActiveDocument.Selection.LineUp flase, 5
    ActiveDocument.Selection.EndOfLine
End Sub

知识共享许可协议 知识共享署名-非商业性使用-相同方式共享码农场 » 在VC中快速加入注释的宏

分享到:更多 ()

评论 欢迎留言

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

我的开源项目

HanLP自然语言处理包基于DoubleArrayTrie的Aho Corasick自动机