LanguageService::QueryService Method (Guid, Guid, IntPtr)
Visual Studio 2015
Returns the request interface from the specified service.
Assembly: Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)
public: virtual int QueryService( Guid% guidService, Guid% iid, [OutAttribute] IntPtr% obj )
Parameters
- guidService
-
Type:
System::Guid
[in] The GUID of the service to query.
- iid
-
Type:
System::Guid
[in] The GUID of the desired interface.
- obj
-
Type:
System::IntPtr
[out] An unmarshaled pointer to the interface.
The base method calls LanguageService::GetService to obtain the IOleServiceProvider interface and passes the call on to its QueryService. This method is an implementation of QueryService.
This example shows how to use this method to query for an interface and marshal the resulting pointer into an actual interface object.
IVsUIShell GetUIShell(Microsoft.VisualStudio.OLE.Interop.IServiceProvider pProvider)
{
IVsUIShell pUIShell = null;
IntPtr ptr = IntPtr.Zero;
pProvider.QueryService.(typeof(SVsUIShell).GUID,ptr);
if (ptr != IntPtr.Zero)
{
pUIShell = (IVsUIShell)Marshal.GetObjectForIUnknown(ptr);
}
return pUIShell;
}
Show: