Programming Guide



sm_com_QueryInterface

Accesses an interface of a COM component

#include <smmwuser.h>
hr = sm_com_QueryInterface(obj_id, iid, ppv);
HRESULT hr;
REFIID iid;
LPVOID *ppv;

obj_id
An integer handle that identifies the COM object whose interface you want to get. The handle is returned by sm_obj_create for service components, sm_prop_id for ActiveX controls.

Environment

Windows, Web; C only

Returns

Description

sm_com_QueryInterface can be used to access an interface of a COM component. This function provides low-level access to the component and, as such, can only be called from C or C++.

For more information on using the QueryInterface method, refer to the ActiveX and COM specifications.

Example

int id = sm_prop_id ("treeview");
LPDISPATCH pDispatch;
HRESULT hr;

hr = sm_com_QueryInterface
(id, IID_IDispatch, (LPVOID *)&pDispatch);

if (SUCCEEDED(hr))
{
...
pDispatch->Release ();
}