Share via


ItemOperations.IsFileOpen 메서드

저장된 파일 중 특정 파일이 지정된 뷰에 현재 열려 있는지 여부를 나타냅니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
Function IsFileOpen ( _
    FileName As String, _
    ViewKind As String _
) As Boolean
bool IsFileOpen(
    string FileName,
    string ViewKind
)
bool IsFileOpen(
    [InAttribute] String^ FileName, 
    [InAttribute] String^ ViewKind
)
abstract IsFileOpen : 
        FileName:string * 
        ViewKind:string -> bool
function IsFileOpen(
    FileName : String, 
    ViewKind : String
) : boolean

매개 변수

  • FileName
    형식: String

    필수입니다. 저장된 파일 중 특정 파일의 절대 경로입니다. 파일을 만들었지만 아직 저장하지 않은 경우에는 IsFileOpen에서 false를 반환합니다.

  • ViewKind
    형식: String

    선택 사항 저장된 파일이 현재 열려 있는 뷰의 형식을 나타내는 Constants .vsViewKind* 상수입니다.

반환 값

형식: Boolean
파일이 지정된 뷰에 열려 있으면 true를 나타내고 그렇지 않으면 false를 나타내는 부울 값입니다.

예제

Sub IsFileOpenExample()
    Dim soln As Solution = DTE.Solution
    Dim prj As Project
    Dim prjItem As ProjectItem
    Dim ItemOp As ItemOperations
    Dim savePath As String

    ' Create a new text document.
    ItemOp = DTE.ItemOperations
    ItemOp.NewFile("General\Text File", "Some name", _
    Constants.vsViewKindTextView)

    ' Set variables for proj and proj item names.
    prj = soln.Item(1)
    prjItem = prj.ProjectItems.Item(1)
    savePath = "C:\UserFiles\KempB\" & prjItem.Name
    MsgBox(savePath)

    If ItemOp.IsFileOpen(savePath) = True Then
        MsgBox("The saved document is open.")
    Else
        MsgBox("The saved document is not open.")
    End If

    prjItem.Save(savePath)
        
    If ItemOp.IsFileOpen(savePath) = True Then
        MsgBox("The saved document is open.")
    Else
        MsgBox("The saved document is not open.")
    End If
End Sub

.NET Framework 보안

참고 항목

참조

ItemOperations 인터페이스

EnvDTE 네임스페이스