I'm following mcdave's advice from http://stackoverflow.com/questions/2191637 and using SubclassWindpow
to host a CIPAddressCtrl in a winforms app. My constructor looks like this:
IPAddressBox::IPAddressBox(void)
{
// I have tried it with and without this part
INITCOMMONCONTROLSEX icc;
icc.dwICC = ICC_INTERNET_CLASSES;
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
::InitCommonControlsEx(&icc);
m_pCtrl = new CIPAddressCtrl();
}
and my OnHandleCreated function looks like this:
void IPAddressBox::OnHandleCreated(EventArgs^ e)
{
if (m_pCtrl->GetSafeHwnd() != NULL)
throw gcnew InvalidOperationException("Cannot create handle; MFC control already has an HWND");
if (!m_pCtrl->SubclassWindow((HWND)this->Handle.ToPointer()))
throw gcnew InvalidOperationException("Could not attach MFC control");
Control::OnHandleCreated(e);
}
When my winforms control is shown on screen, nothing happens - the control's BackColor shows and I don't see a CIPAddressCtrl.
What do I need to do to get the CIPAddressCtrl to draw itself on the screen?