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 添加函數描述