2007年6月20日星期三

创建main.cpp的宏

Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics

Public Module RecordingModule


Sub TemporaryMacro()
DTE.ItemOperations.AddNewItem("Visual C++\C++ 文件(.cpp)", "main.cpp")
DTE.ActiveDocument.Selection.Text = "#include <>"
DTE.ActiveDocument.Selection.CharLeft()
DTE.ActiveDocument.Selection.Text = "iostream"
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "using namespace std;"
DTE.ActiveDocument.Selection.NewLine(2)
DTE.ActiveDocument.Selection.Text = "void main(){}"
DTE.ActiveDocument.Selection.CharLeft()
DTE.ActiveDocument.Selection.NewLine(2)
DTE.ActiveDocument.Selection.LineUp()
DTE.ActiveDocument.Selection.Indent()
DTE.ActiveDocument.Selection.Text = "getchar();"
End Sub
End Module

没有评论: