AtlAxAttachControl can create an interface from a coclass and show it on an windows.
the atl's code is :
ATLINLINE ATLAPI AtlAxAttachControl(IUnknown* pControl, HWND hWnd, IUnknown** ppUnkContainer)
{
AtlAxWinInit();
if (pControl == NULL)
return E_INVALIDARG;
CComPtr<IUnknown> spUnkContainer;
HRESULT hr = CAxHostWindow::_CreatorClass::CreateInstance(NULL, __uuidof(IUnknown), (void**)&spUnkContainer);
if (SUCCEEDED(hr))
{
CComPtr<IAxWinHostWindow> spAxWindow;
hr = spUnkContainer->QueryInterface(&spAxWindow);
if (SUCCEEDED(hr))
hr = spAxWindow->AttachControl(pControl, hWnd);
}
if (ppUnkContainer != NULL)
{
*ppUnkContainer = SUCCEEDED(hr) ? spUnkContainer.Detach() : NULL;
}
return hr;
}