Partager via


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
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 GetFormatFilterList).

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, which is the pbstrFilterList parameter of GetFormatFilterList of the filter matching the extension of the file inbstrFileName. For example, if ".*" was passed into the default filter (see GetFormatFilterList), 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

Microsoft.VisualStudio.TextManager.Interop Namespace