다음을 통해 공유


IDebugDocumentContext2::GetLanguageInfo

Gets the language associated with this document context.

HRESULT GetLanguageInfo( 
   BSTR* pbstrLanguage,
   GUID* pguidLanguage
);
int GetLanguageInfo( 
   out string pbstrLanguage,
   out Guid   pguidLanguage
);

Parameters

  • pbstrLanguage
    [out] Returns the name of the language that implements the code at this document context.

  • pguidLanguage
    [out] Returns the GUID of the language that implements the code at this document context. For example, guidVBScriptLang or guidCPPLang. This GUID is not limited to the languages supplied by Visual Studio.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Example

The following example shows how to implement this method for a simple CDebugContext object that exposes the IDebugDocumentContext2 interface.

HRESULT CDebugContext::GetLanguageInfo(BSTR* pbstrLanguage, GUID* pguidLanguage)  
{  
   HRESULT hr;  
  
   // Check for a valid language argument pointers.  
   if (pbstrLanguage && pguidLanguage)  
   {  
      *pguidLanguage = GUID_NULL;  
      *pbstrLanguage = SysAllocString(L"Batch File");  
      if (*pbstrLanguage)  
      {  
         *pguidLanguage = guidBatLang;  
         hr = S_OK;  
      }  
      else  
      {  
         hr = E_OUTOFMEMORY;  
      }  
   }  
   else  
   {  
      hr = E_INVALIDARG;  
   }  
  
   return hr;  
}  

See Also

Reference

IDebugDocumentContext2