mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[ATL] Added CComPtr.CoCreateInstance helper methods (#5905)
This commit is contained in:
parent
8d54c2d433
commit
c6ec8d924e
1 changed files with 23 additions and 0 deletions
|
@ -98,6 +98,19 @@ public:
|
||||||
p->Release();
|
p->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CoCreateInstance(REFCLSID rclsid, REFIID riid, LPUNKNOWN pOuter = NULL, DWORD ClsCtx = CLSCTX_ALL)
|
||||||
|
{
|
||||||
|
ATLASSERT(!p);
|
||||||
|
return ::CoCreateInstance(rclsid, pOuter, ClsCtx, riid, (void**)&p);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CoCreateInstance(LPCOLESTR ProgID, REFIID riid, LPUNKNOWN pOuter = NULL, DWORD ClsCtx = CLSCTX_ALL)
|
||||||
|
{
|
||||||
|
CLSID clsid;
|
||||||
|
HRESULT hr = CLSIDFromProgID(ProgID, &clsid);
|
||||||
|
return FAILED(hr) ? hr : CoCreateInstance(clsid, riid, pOuter, ClsCtx);
|
||||||
|
}
|
||||||
|
|
||||||
T *operator = (T *lp)
|
T *operator = (T *lp)
|
||||||
{
|
{
|
||||||
T* pOld = p;
|
T* pOld = p;
|
||||||
|
@ -142,6 +155,16 @@ public:
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pOuter = NULL, DWORD ClsCtx = CLSCTX_ALL)
|
||||||
|
{
|
||||||
|
return CoCreateInstance(rclsid, __uuidof(T), pOuter, ClsCtx);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CoCreateInstance(LPCOLESTR ProgID, LPUNKNOWN pOuter = NULL, DWORD ClsCtx = CLSCTX_ALL)
|
||||||
|
{
|
||||||
|
return CoCreateInstance(ProgID, __uuidof(T), pOuter, ClsCtx);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Release()
|
void Release()
|
||||||
|
|
Loading…
Reference in a new issue