Пример #1
0
CIEHostWindow* CPlugin::CreateIEHostWindow(HWND hParent, DWORD dwId)
{
  CIEHostWindow *pIEHostWindow = NULL;
  CWnd parent;
  if (!parent.Attach(hParent))
  {
    return FALSE;
  }
  try
  {
    pIEHostWindow = CIEHostWindow::CreateNewIEHostWindow(dwId);
    if (pIEHostWindow == NULL)
    {
      throw CString(_T("Cannot Create CIEHostWindow!"));
    }
    pIEHostWindow->SetPlugin(this);
    pIEHostWindow->SetParent(&parent);
    CRect rect;
    parent.GetClientRect(rect);
    pIEHostWindow->MoveWindow(rect);
    pIEHostWindow->ShowWindow(SW_SHOW);
  }
  catch (CString strMessage)
  {
    if (pIEHostWindow) 
    {
      delete pIEHostWindow;
      pIEHostWindow = NULL;
    }
    TRACE(_T("[CPlugin::CreateIEHostWindow] Exception: %s\n"), (LPCTSTR)strMessage);
  }
  parent.Detach();
  return pIEHostWindow;
}
Пример #2
0
	CIEHostWindow* CPlugin::CreateIEHostWindow(HWND hParent, ULONG_PTR ulId, bool isUtils, bool* opIsNewlyCreated)
	{
		CIEHostWindow *pIEHostWindow = NULL;
		CWnd parent;
		if (!parent.Attach(hParent))
		{
			return NULL;
		}
		try
		{
			pIEHostWindow = CIEHostWindow::CreateNewIEHostWindow(&parent, ulId, isUtils, opIsNewlyCreated);
			if (pIEHostWindow == NULL)
			{
				throw CString(_T("Cannot Create CIEHostWindow!"));
			}
			if (isUtils)
			{
				// For content plugins, SetPlugin will be delayed until SPO initialization,
				// in order to avoid event ordering issues.
				pIEHostWindow->SetPlugin(this);
			}
			pIEHostWindow->SetParent(&parent);
			CRect rect;
			parent.GetClientRect(rect);
			pIEHostWindow->MoveWindow(rect);
			pIEHostWindow->ShowWindow(SW_SHOW);
		}
		catch (const CString& strMessage)
		{
			if (pIEHostWindow)
			{
				delete pIEHostWindow;
				pIEHostWindow = NULL;
			}
			UNUSED(strMessage);
			TRACE(_T("[CPlugin::CreateIEHostWindow] Exception: %s\n"), (LPCTSTR)strMessage);
		}
		parent.Detach();
		return pIEHostWindow;
	}