how to execute non-static method on class instance?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello,

I have one question. If I want to execute static method in WMI, there is no
problem.

CComPtr<IWbemServices> pSvc = NULL;
// set pSvc through ConnectServer()
hres = pSvc->ExecMethod(_bstr_t(_T("BcdStore")), _bstr_t(_T("OpenStore")),
0, NULL, pInParamsObj, &pOutParamsObj, NULL);

This works since OpenStore is static method of BcdStore class.

But once I have BcdStore class instance (OpenStore method creates instance),
then I need to call its member method OpenObject. How to do this?

I get output param from static method OpenStore() - BcdStore object:
IWbemClassObject* pBcdObj;

But now how should I call OpenObject method on this BcdStore object?
hres = pSvc->ExecMethod(strObjectPath, _bstr_t(_T("OpenObject")), 0, NULL,
pInParamsObj, &pOutParamsObj, NULL);
How should I use pBcdObj to get strObjectPath used in previous line of code?
Or is there some other way how to call method on class instance?

Thanks very much.

Michal
.