IMsoComponentManager Interface

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Defines a component manager, which is an object that coordinates other components by using its message loop for message processing and allocation of idle time.

Inherits from

IUnknown

Interface identifier

IID_IMsoComponentManager = {000C060B-0000-0000-C000-000000000046}

Service identifier

SID_SMsoComponentManager = {000C0601-0000-0000-C000-000000000046}

Vtable Order

QueryService

Returns an implementation of the specified service.

FDebugMessage

This method is reserved for internal use and is not intended to be used in your code. This method always returns TRUE.

FRegisterComponent

Registers a component with the component manager.

FRevokeComponent

Revokes the registration of the component that is identified by the dwComponentID parameter.

FUpdateComponentRegistration

Updates the registration information of the specified component with new registration information.

FOnComponentActivate

Notifies the component manager that the component that is identified by the dwComponentID parameter was activated.

FSetTrackingComponent

Informs the component manager that a component needs to perform a tracking operation (such as mouse tracking).

OnComponentEnterState

Notifies the component manager that the specified component is entering the state identified by the uStateID parameter.

FOnComponentExitState

Notifies the component manager that the component identified by the dwComponentID parameter is exiting the state identified by the uStateID parameter.

FInState

Indicates whether the state specified by uStateID is in effect.

FContinueIdle

Indicates whether a component can continue its idle-time processing.

FPushMessageLoop

Pushes a message loop on behalf of the component identified by the dwComponentID parameter for the reason identified by the uReason parameter.

FCreateSubComponentManager

This method is reserved for internal use and is not intended to be used in your code.

FGetParentComponentManager

This method is reserved for internal use and is not intended to be used in your code.

FGetActiveComponent

Returns the current active or tracking component.

Remarks

You can get an instance of this interface by calling the CoRegisterMessageFilter function to get a reference to the current message filter. Ensure that you immediately call the CoRegisterMessageFilter function again to put the object back right away. Then call the QueryInterface method on the returned message filter to get an IServiceProvider interface. Finally, call the QueryService method on the IServiceProvider interface to get an IMsoComponentManager interface.

Example

The following code example shows how to obtain an object that implements the IMsoComponentManager interface.

DEFINE_GUID(IID_IMsoComponentManager, 0x000C060B, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
DEFINE_GUID(SID_SMsoComponentManager, 0x000C0601, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);

HRESULT GetMsoComponentManager(IMsoComponentManager **ppComponentManager)
{
    if (ppComponentManager == NULL)
       return E_POINTER;
    *ppComponentManager = NULL;

    HRESULT hr = E_FAIL;

    // Get the previous message filter by temporarily registering a new NULL message filter.
    IMessageFilter* pMessageFilter = NULL;
    if (SUCCEEDED(hr = CoRegisterMessageFilter(NULL, &pMessageFilter)))
    {
        // Put the old message filter back in place.
        CoRegisterMessageFilter(pMessageFilter, NULL);

        if (pMessageFilter != NULL)
        {
            // Get the IServiceProvider implementation.
            IServiceProvider *pServiceProvider = NULL;
            if (SUCCEEDED(hr = pMessageFilter->QueryInterface(IID_IServiceProvider, (void**)&pServiceProvider)))
            {
                if (pServiceProvider != NULL)
                {
                    hr = pServiceProvider->QueryService(IID_IMsoComponentManager, SID_SMsoComponentManager, (void**)ppComponentManager);
                    pServiceProvider->Release();
                }
                else
                {
                    hr = E_POINTER;
                }
            }
            pMessageFilter->Release();
        }
        else
        {
            hr = S_FALSE;
        }
    }
    return hr;
}

See Also

Reference

IMsoComponent Interface

Concepts

Component API Interfaces