검색결과 리스트
ALT+O에 해당되는 글 1건
- 2011.02.15 [링크] 매크로를 이용한 Visual Studio .h .cpp 전환
글
Visual Assist X를 사용하면 제일 편한 기능중 하나가 .h와 .cpp간의 전환 단축키 입니다.
이걸 매크로로 구현한 글이 있어서 링크 합니다.
Visual Studio 2005, 2008에서 동작 확인했습니다.
Function OpenDocument(ByVal path As String) As Window
If (My.Computer.FileSystem.FileExists(path)) Then
OpenDocument = DTE.ItemOperations.OpenFile(path)
Else
Dim filename As String
filename = path.Substring(path.LastIndexOf("\") + 1)
Dim item As ProjectItem
item = DTE.Solution.FindProjectItem(filename)
If (item IsNot Nothing) Then
If (item.Document Is Nothing) Then
OpenDocument = item.Open()
Else
OpenDocument = item.Document.ActiveWindow()
End If
End If
End If
If (OpenDocument IsNot Nothing) Then
OpenDocument.Activate()
End If
End
Function Sub ToggleBetweenSourceAndHeader()
Dim document As Document
document = DTE.ActiveDocument
Dim path As String
path = document.FullName
Dim ext_position As Integer
ext_position = path.LastIndexOf(".")
If (ext_position <> -1) Then
Dim ext As String
ext = path.Substring(ext_position)
Dim path_without_ext As String
path_without_ext = path.Remove(ext_position, ext.Length())
If (ext.ToLower().Contains(".cpp")) Then ' .cpp -> .hpp or .h
If (OpenDocument(path_without_ext & ".hpp") Is Nothing) Then
OpenDocument(path_without_ext & ".h")
End If
ElseIf (ext.ToLower().Contains(".cxx")) Then ' .cxx -> .hxx
OpenDocument(path_without_ext & ".hxx")
ElseIf (ext.ToLower().Contains(".cc")) Then ' .cc -> .hh
OpenDocument(path_without_ext & ".hh")
ElseIf (ext.ToLower().Contains(".c")) Then
OpenDocument(path_without_ext & ".h")
ElseIf (ext.ToLower().Contains(".h")) Then ' .h -> .c or .cpp
If (OpenDocument(path_without_ext & ".c") Is Nothing) Then
OpenDocument(path_without_ext & ".cpp")
End If
ElseIf (ext.ToLower().Contains(".hpp")) Then ' .hpp -> .cpp
OpenDocument(path_without_ext & ".cpp")
ElseIf (ext.ToLower().Contains(".hxx")) Then ' .hxx -> .cxx
OpenDocument(path_without_ext & ".cxx")
ElseIf (ext.ToLower().Contains(".hh")) Then ' .hh -> .cc
OpenDocument(path_without_ext & ".cc")
End If
End If
End Sub
'IDE/Tool > Visual Studio' 카테고리의 다른 글
[Visual Studio] 마법사 만들기 (0) | 2012.03.08 |
---|---|
[Visual Studio 2008] Unicode 기반 프로그램에서 한글이 깨지는 현상 (0) | 2011.03.01 |
FAT32, NTFS 포맷 방식이 컴파일에 영향을 준다. (1) | 2008.10.12 |
Platform SDK 설치 (1) | 2008.09.18 |
[Visual Studio 2005] Windows 2003에서 Visual Studio 2005 SP1 설치 오류 문제 (0) | 2008.02.20 |
RECENT COMMENT