Freigeben über


IVsFormatFilterProvider.CurFileExtensionFormat Method

Provides the index in the filter list that matches the extension of the file passed in.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

Syntax

'Declaration
Function CurFileExtensionFormat ( _
    bstrFileName As String, _
    <OutAttribute> ByRef pdwExtnIndex As UInteger _
) As Integer
'Usage
Dim instance As IVsFormatFilterProvider
Dim bstrFileName As String
Dim pdwExtnIndex As UInteger
Dim returnValue As Integer

returnValue = instance.CurFileExtensionFormat(bstrFileName, _
    pdwExtnIndex)
int CurFileExtensionFormat(
    string bstrFileName,
    out uint pdwExtnIndex
)
int CurFileExtensionFormat(
    [InAttribute] String^ bstrFileName, 
    [OutAttribute] unsigned int% pdwExtnIndex
)
abstract CurFileExtensionFormat : 
        bstrFileName:string * 
        pdwExtnIndex:uint32 byref -> int 
function CurFileExtensionFormat(
    bstrFileName : String, 
    pdwExtnIndex : uint
) : int

Parameters

  • bstrFileName
    Type: System.String
    [in] Filename and extension of interest.
  • pdwExtnIndex
    Type: System.UInt32%
    [out] Index in the FormatFilterList (the pbstrFilterList parameter of [M:Microsoft.VisualStudio.TextManager.Interop.IVsFormatFilterProvider.GetFormatFilterList(][System.String@)].)

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From textmgr.idl:

HRESULT IVsFormatFilterProvider::CurFileExtensionFormat(
   [in]BSTR bstrFileName,
   [out] DWORD *pdwExtnIndex
);

The index returned in pdwExtnIndex is determined by the place in the FormatFilterList (the pbstrFilterList parameter of [M:Microsoft.VisualStudio.TextManager.Interop.IVsFormatFilterProvider.GetFormatFilterList(][System.String@)] of the filter matching the extension of the file in bstrFileName. For example, if ".*" was passed into the default filter (see [M:Microsoft.VisualStudio.TextManager.Interop.IVsFormatFilterProvider.GetFormatFilterList(][System.String@)], 0 would be stored in pdwExtnIndex. Likewise a 1 would be stored for a ".txt" passed in. You should only be concerned with your file extensions and not the All Files or Text Files. If the file extension in bstrFileName doesn't match one that you support, return E_FAIL.

.NET Framework Security

See Also

Reference

IVsFormatFilterProvider Interface

IVsFormatFilterProvider Members

Microsoft.VisualStudio.TextManager.Interop Namespace