Roman Dadkov romand@etersoft.ru wrote:
- hr = CLSIDFromProgID(WordApp, &clsid);
- if (SUCCEEDED(hr))
- {
hr = CoCreateInstance(&clsid, NULL, CLSCTX_ALL, &IID_IUnknown, (void **)&pUnknown);
ok_ole_success(hr, "CoCreateInstance");
hr = IUnknown_QueryInterface(pUnknown, &IID_IRunnableObject, (void**)&pRunnableObject);
ok_ole_success(hr, "IUnknown_QueryInterface");
if (FAILED(hr))
Shouldn't 'SUCCEEDED(hr)' be used here instead?
{
hr = IRunnableObject_Run(pRunnableObject, NULL);
ok_ole_success(hr, "IRunnableObject_Run");
}
- }
Probably you should add Release() calls where appropriate.