一般使用其他的开发工具,都可以插入文件版本信息等注释。尤其在Eclipse里面这些功能做的相当的好。DEV-CPP也提供了一个简单的文件信息注释,但是VC6.0却没有现成的注释可供插入。不过利用VC6.0的宏功能却可以达到我们需要的效果。
要做到如下的效果:
/ // 函数说明: // 参数说明: [in]: [out]: // 返回值: // 函数作者: wangxf 创建日期: 2009-02-27 16:43:33 QQ:95228084 / // wangxf 创建日期: 2009-02-27 16:43:37 QQ:95228084 // // wangxf 创建日期: 2009-02-27 16:43:44 |
在菜单Tools下选择Macro,会弹出一个对话框,选择Record,之后输入名字,这里我输入的是FILECOMMENT,然后录制了一段,回到这个界面,点击Edit。由此观察代码,最后修改的代码格式在后面给出。在Macro弹出的界面选择Options,选择Keystore,这时你就可以输入一个快捷方式,这里我使用的是Ctrl+E。以后在需要使用这个注释时,直接使用快捷键Ctrl+E就OK了。
Sub wangxf() 'DESCRIPTION: wangxf ActiveDocument.Selection = "/" ActiveDocument.Selection.NewLine ActiveDocument.Selection = "// 函数说明: " ActiveDocument.Selection.NewLine ActiveDocument.Selection = "// 参数说明: [in]: [out]: " ActiveDocument.Selection.NewLine ActiveDocument.Selection = "// 返回值: " ActiveDocument.Selection.NewLine ActiveDocument.Selection = "// 函数作者: wangxf" ActiveDocument.Selection = " 创建日期: " ActiveDocument.Selection = DATE + TIME ActiveDocument.Selection = " QQ:95228084 " ActiveDocument.Selection.NewLine ActiveDocument.Selection = "/" 'Begin Recording 'End Recording End Sub Sub Remarks() 'DESCRIPTION: 内容注释 ActiveDocument.Selection = "// wangxf" ActiveDocument.Selection = " 创建日期: " ActiveDocument.Selection = DATE + TIME ActiveDocument.Selection = " QQ:95228084 " ActiveDocument.Selection.NewLine ActiveDocument.Selection = "// " 'Begin Recording ExecuteCommand "SelectSwapAnchor" 'End Recording End Sub Sub ReMarkRow() 'DESCRIPTION: 注释行 ActiveDocument.Selection = "// wangxf" ActiveDocument.Selection = " 创建日期: " ActiveDocument.Selection = DATE + TIME 'Begin Recording ExecuteCommand "SelectSwapAnchor" 'End Recording End Sub |