SContainerDispatch Interface

 

Passed to the QueryService method to return a reference to the .ebbff4bc-36b2-4861-9efa-ffa45e013eb5

Namespace:   Microsoft.VisualStudio.OLE.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

[GuidAttribute("B722BE00-4E68-101B-A2BC-00AA00404770")]
public interface SContainerDispatch

The  is implemented on any control or VSPackage that supports automation. However, to obtain the IDispatch interface, it is necessary to query the control or VSPackage for a service provider and ask that service provider to obtain the IDispatch interface from the SContainerDispatch service. See the example for how this can be accomplished. ebbff4bc-36b2-4861-9efa-ffa45e013eb5

This example shows how to obtain the  from the SContainerDispatch service.ebbff4bc-36b2-4861-9efa-ffa45e013eb5

IDispatch GetDispatchInterface(object pUnknown)
{
    IDispatch pDispatchInterface = null;
    if (null != pUnknown)
    {
        Microsoft.VisualStudio.OLE.Interop.IServiceProvider pServiceProvider;
        pServiceProvider = pUnknown as Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
        if (null != pServiceProvider)
        {
            Guid   serviceGuid   = typeof(SContainerDispatch).GUID;
            Guid   interfaceGuid = typeof(IDispatch).GUID;
            IntPtr pInterface    = IntPtr.Zero;
            int hr = pServiceProvider.QueryService(ref serviceGuid,
                                                   ref interfaceGuid,
                                                   out pInterface);
            if (Microsoft.VisualStudio.ErrorHandler.Succeeded(hr))
            {
                 pDispatchInterface = Marshal.GetObjectForIUnknown(pInterface)
                                      as IDispatch;
            }
        }
    }
    return pDispatchInterface;
}
Return to top
Show: