IUnknown_QueryService

Given an arbitrary interface pointer to an object, this function calls the object’s QueryService method.

Declaration

HRESULT
IUnknown_QueryService (
    IUnknown *punk,
    REFGUID guidService,
    REFIID riid,
    void **ppvObject);

Parameters

The punk argument is any interface pointer for the object of interest.

The subsequent arguments are for the object’s QueryService method.

Return Value

The function returns zero for success, else an error code.

Behaviour

The object is expected to implement the IServiceProvider interface.

If the punk argument is NULL, then there is no object to query for the expected interface, and the function returns E_FAIL. If the object does not implement the expected interface, the function returns the result from the failed QueryInterface.

Once the function has obtained a pointer to the expected interface for the given object, it uses this interface pointer to call the QueryService method. The guidService, riid and ppvObject arguments are passed as given. The function then releases the interface pointer. The result of calling the method becomes the result of the function.

Availability

The IUnknown_QueryService function is exported from SHLWAPI.DLL as ordinal 176 in version 5.00 and higher.