1.注释宏函数定义,请修改DefaultUserName 为自己的姓名
'DESCRIPTION: 添加一个标准的头文件说明 DTE.ActiveDocument.Selection.StartOfDocument() DefaultUserName = "XXX" Dim FileName FileName = DTE.ActiveDocument.Name selection = DTE.ActiveDocument.Selection
selection.Text = "/*******************************************************************" + CStr(CrLf) selection.Text = selection.Text + "文件名 :" + FileName + CStr(CrLf) selection.Text = selection.Text + "创建者 :" + DefaultUserName selection.Text = selection.Text + CStr(CrLf) + "创建时间 :" + CStr(Now) selection.Text = selection.Text + CStr(CrLf) + "功能描述 :" selection.Text = selection.Text + CStr(Lf) + "** " selection.Text = selection.Text + CStr(Lf) + "******************************************************************/" + CStr(Lf) DTE.ActiveDocument.Selection.LineUp(flase, 3) DTE.ActiveDocument.Selection.EndOfLine() End Sub
Sub AddMethodDesc() 'DESCRIPTION: 添加函数注释 Dim MethodName DefaultUserName = "helq" MethodName = DTE.ActiveDocument.Selection.Text DTE.ActiveDocument.Selection.StartOfLine() selection = DTE.ActiveDocument.Selection selection.Text = "/******************************************************************" selection.Text = selection.Text + CStr(CrLf) + "函数名 :" + MethodName selection.Text = selection.Text + "创建者 :" + DefaultUserName selection.Text = selection.Text + CStr(CrLf) + "参数 :" selection.Text = selection.Text + CStr(CrLf) + "返回值 :" selection.Text = selection.Text + CStr(CrLf) + "功能描述 :" selection.Text = selection.Text + CStr(CrLf) + "* " selection.Text = selection.Text + CStr(CrLf) + "******************************************************************/" + CStr(CrLf)
DTE.ActiveDocument.Selection.LineUp(flase, 5) DTE.ActiveDocument.Selection.EndOfLine() End Sub |
2. 打开vc,工具菜单中选择 工具-〉宏->宏IDE
3. 宏ide,在资源管理器中选择sample->DevStudio6Editor ,把宏函数拷贝右侧编辑框中
4.回到vc 2008 ide,选择 工具->宏-〉宏资源管理器
双击addheaddesc 添加文件描述
选择函数名称,双击 addMethodDesc 添加函数描述