Open alexey-malov opened 6 years ago
auto r = GetClientRect(hWnd, &rect);
assert(r == TRUE);
::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
auto hr = m_pFactory.CoCreateInstance(__uuidof(ID2D1Factory));
assert(hr != S_FALSE); // Не возвращает S_OK
hr = m_pRenderTarget.CoCreateInstance(__uuidof(ID2D1HwndRenderTarget));
assert(hr != S_FALSE);
hr = m_pBrush.CoCreateInstance(__uuidof(ID2D1SolidColorBrush));
assert(hr != S_FALSE);
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pFactory);
assert(hr == S_OK);
D2DCanvas::~D2DCanvas()
{
::CoUninitialize();
}
CComPtr/CComQIPtr
(из ATL) либо _com_ptr