IUnknown_QueryService function
Retrieves an interface for a service from a specified object.
Syntax
HRESULT IUnknown_QueryService(
_In_ IUnknown *punk,
_In_ REFGUID guidService,
_In_ REFIID riid,
_Out_ void **ppvOut
);
Parameters
- punk [in]
-
Type: IUnknown*
A pointer to the IUnknown instance of the COM object that supports the service.
- guidService [in]
-
Type: REFGUID
The service's unique identifier (SID).
- riid [in]
-
Type: REFIID
The IID of the desired service interface.
- ppvOut [out]
-
Type: void**
When this method returns, contains the interface pointer requested riid. If successful, the calling application is responsible for calling IUnknown::Release using this value when the service is no longer needed. In the case of failure, this value is NULL.
Return value
Type: HRESULT
Returns S_OK if successful. Returns E_FAIL if the object does not support IServiceProvider. Otherwise, the function returns the HRESULT returned by the object's QueryService method.
Remarks
If the object passed in the punk parameter supports the IServiceProvider interface, then its QueryService method is invoked, passing the guidService, riid, and ppvOut parameters and propagating the return value. Otherwise, the function returns E_FAIL.
For those versions of Windows that do not include IUnknown_QueryService in Shlwapi.h, this function must be called directly from Shlwapi.dll using ordinal 176.
Requirements
|
Minimum supported client |
Windows 2000 Professional, Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server, Windows Server 2003 [desktop apps only] |
|
Header |
|
|
DLL |
|
See also