Windows/MFC
[MACRO] VS2005 Macro (base comment)
aucd29
2013. 10. 2. 18:15
Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Public Module RecordingModule
Sub comment()
DTE.ActiveDocument.Selection.Text = "//"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "//"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "//"
DTE.ActiveDocument.Selection.LineUp()
DTE.ActiveDocument.Selection.Text = " "
End Sub
Sub doccomment()
Dim objStartPt As EditPoint
With DTE.ActiveDocument.Selection
.Text = "//"
.NewLine()
.Text = "// DATE : "
.Text = MonthType(System.DateTime.Now.Month)
.Text = " "
.Text = System.DateTime.Now.Day.ToString()
objStartPt = .TextRanges.item(1).StartPoint.CreateEditPoint()
objStartPt.Insert(", ")
.Text = System.DateTime.Now.Year.ToString()
.Text = " "
.Text = System.DateTime.Now.Hour.ToString()
.Text = ":"
.Text = System.DateTime.Now.Minute.ToString()
.Text = ":"
.Text = System.DateTime.Now.Second.ToString()
.NewLine()
.Text = "// CODER : aucd29(ccd@apsat.co.kr)"
.NewLine()
.Text = "// URL : http://www.apsat.co.kr"
.NewLine()
.Text = "// "
.NewLine()
.Text = "// Copyright Asia pasific satellite industries Co."
objStartPt = .TextRanges.item(1).StartPoint.CreateEditPoint()
objStartPt.Insert(", ")
.Text = "Ltd. "
.NewLine()
.Text = "// "
.NewLine()
.Text = "// -----------------------------------------------------------"
.NewLine()
.Text = "// "
.NewLine()
End With
End Sub
Function MonthType(ByVal month As Integer) As String
Dim szMonth
If month = 1 Then
szMonth = "January"
ElseIf month = 2 Then
szMonth = "February"
ElseIf month = 3 Then
szMonth = "March"
ElseIf month = 4 Then
szMonth = "April"
ElseIf month = 5 Then
szMonth = "May"
ElseIf month = 6 Then
szMonth = "June"
ElseIf month = 7 Then
szMonth = "July"
ElseIf month = 8 Then
szMonth = "August"
ElseIf month = 9 Then
szMonth = "September"
ElseIf month = 10 Then
szMonth = "October"
ElseIf month = 11 Then
szMonth = "November"
ElseIf month = 12 Then
szMonth = "December"
End If
Return szMonth
End Function
Sub CMT_NOTE()
Dim objStartPt As EditPoint
With DTE.ActiveDocument.Selection
.Text = "// -----------------------------------------------------------"
.NewLine()
.Text = "// NOTE : "
.Text = MonthType(System.DateTime.Now.Month)
.Text = " "
.Text = System.DateTime.Now.Day.ToString()
objStartPt = .TextRanges.item(1).StartPoint.CreateEditPoint()
objStartPt.Insert(", ")
.Text = System.DateTime.Now.Year.ToString()
.Text = " "
.Text = System.DateTime.Now.Hour.ToString()
.Text = ":"
.Text = System.DateTime.Now.Minute.ToString()
.Text = ":"
.Text = System.DateTime.Now.Second.ToString()
.NewLine()
.Text = "// -----------------------------------------------------------"
.NewLine()
.Text = "// * "
End With
End Sub
End Module
[code]매크로를 올리고 더블 클릭하면 그림과 같이 날짜와 시간이 사사삭... [/code]
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Public Module RecordingModule
Sub comment()
DTE.ActiveDocument.Selection.Text = "//"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "//"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "//"
DTE.ActiveDocument.Selection.LineUp()
DTE.ActiveDocument.Selection.Text = " "
End Sub
Sub doccomment()
Dim objStartPt As EditPoint
With DTE.ActiveDocument.Selection
.Text = "//"
.NewLine()
.Text = "// DATE : "
.Text = MonthType(System.DateTime.Now.Month)
.Text = " "
.Text = System.DateTime.Now.Day.ToString()
objStartPt = .TextRanges.item(1).StartPoint.CreateEditPoint()
objStartPt.Insert(", ")
.Text = System.DateTime.Now.Year.ToString()
.Text = " "
.Text = System.DateTime.Now.Hour.ToString()
.Text = ":"
.Text = System.DateTime.Now.Minute.ToString()
.Text = ":"
.Text = System.DateTime.Now.Second.ToString()
.NewLine()
.Text = "// CODER : aucd29(ccd@apsat.co.kr)"
.NewLine()
.Text = "// URL : http://www.apsat.co.kr"
.NewLine()
.Text = "// "
.NewLine()
.Text = "// Copyright Asia pasific satellite industries Co."
objStartPt = .TextRanges.item(1).StartPoint.CreateEditPoint()
objStartPt.Insert(", ")
.Text = "Ltd. "
.NewLine()
.Text = "// "
.NewLine()
.Text = "// -----------------------------------------------------------"
.NewLine()
.Text = "// "
.NewLine()
End With
End Sub
Function MonthType(ByVal month As Integer) As String
Dim szMonth
If month = 1 Then
szMonth = "January"
ElseIf month = 2 Then
szMonth = "February"
ElseIf month = 3 Then
szMonth = "March"
ElseIf month = 4 Then
szMonth = "April"
ElseIf month = 5 Then
szMonth = "May"
ElseIf month = 6 Then
szMonth = "June"
ElseIf month = 7 Then
szMonth = "July"
ElseIf month = 8 Then
szMonth = "August"
ElseIf month = 9 Then
szMonth = "September"
ElseIf month = 10 Then
szMonth = "October"
ElseIf month = 11 Then
szMonth = "November"
ElseIf month = 12 Then
szMonth = "December"
End If
Return szMonth
End Function
Sub CMT_NOTE()
Dim objStartPt As EditPoint
With DTE.ActiveDocument.Selection
.Text = "// -----------------------------------------------------------"
.NewLine()
.Text = "// NOTE : "
.Text = MonthType(System.DateTime.Now.Month)
.Text = " "
.Text = System.DateTime.Now.Day.ToString()
objStartPt = .TextRanges.item(1).StartPoint.CreateEditPoint()
objStartPt.Insert(", ")
.Text = System.DateTime.Now.Year.ToString()
.Text = " "
.Text = System.DateTime.Now.Hour.ToString()
.Text = ":"
.Text = System.DateTime.Now.Minute.ToString()
.Text = ":"
.Text = System.DateTime.Now.Second.ToString()
.NewLine()
.Text = "// -----------------------------------------------------------"
.NewLine()
.Text = "// * "
End With
End Sub
End Module
[code]매크로를 올리고 더블 클릭하면 그림과 같이 날짜와 시간이 사사삭... [/code]