Programming Guide |
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.
Windows, Web; C only
- · 0: The
HRESULT
isS_OK
; the last call succeeded.
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.
int id = sm_prop_id ("treeview");
LPDISPATCH pDispatch;
HRESULT hr;
hr = sm_com_QueryInterface
(id, IID_IDispatch, (LPVOID *)&pDispatch);
if (SUCCEEDED(hr))
{
...
pDispatch->Release ();
}