共用方式為


IVsTextManager.MapFilenameToLanguageSID Method

Given a file name, determines the registered language service, if one exists, that understands it.

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

Syntax

'宣告
Function MapFilenameToLanguageSID ( _
    pszFileName As String, _
    <OutAttribute> ByRef pguidLangSID As Guid _
) As Integer
int MapFilenameToLanguageSID(
    string pszFileName,
    out Guid pguidLangSID
)
int MapFilenameToLanguageSID(
    [InAttribute] String^ pszFileName, 
    [OutAttribute] Guid% pguidLangSID
)
abstract MapFilenameToLanguageSID : 
        pszFileName:string * 
        pguidLangSID:Guid byref -> int 
function MapFilenameToLanguageSID(
    pszFileName : String, 
    pguidLangSID : Guid
) : int

Parameters

  • pszFileName
    Type: System.String
    [in] File name associated with the language service.
  • pguidLangSID
    Type: System.Guid%
    [out] Pointer to the language service.

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 IVsTextManager::MapFilenameToLanguageSID(
   [in] const WCHAR *pszFileName,
   [out] GUID *pguidLangSID
);

This method allows you to map a file type to the appropriate language service for that type. This mapping works by looking in "HKEY_LOCAL_MACHINE\ Software\Microsoft\Languages\File Extensions" for entries that map an extension to a SID, that is, a CLSID for a language service that presumably implements IVsLanguageInfo.

.NET Framework Security

See Also

Reference

IVsTextManager Interface

Microsoft.VisualStudio.TextManager.Interop Namespace