73 lines
1.9 KiB
C++
73 lines
1.9 KiB
C++
|
//////////////////////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD>ܣ<EFBFBD><DCA3>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ʾHTML<4D><4C>ҳ
|
|||
|
//<2F><><EFBFBD>ߣ<EFBFBD><DFA3><EFBFBD><EFBFBD><EFBFBD>(airen3339@163.com)
|
|||
|
//<2F><><EFBFBD>ڣ<EFBFBD>2005.12
|
|||
|
/////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
|
|||
|
#include "StdAfx.h"
|
|||
|
#include "HtmlCtrl.h"
|
|||
|
|
|||
|
#ifdef _DEBUG
|
|||
|
#define new DEBUG_NEW
|
|||
|
#undef THIS_FILE
|
|||
|
static char THIS_FILE[] = __FILE__;
|
|||
|
#endif
|
|||
|
|
|||
|
IMPLEMENT_DYNAMIC(CHtmlCtrl, CHtmlView)
|
|||
|
BEGIN_MESSAGE_MAP(CHtmlCtrl, CHtmlView)
|
|||
|
ON_WM_DESTROY()
|
|||
|
ON_WM_MOUSEACTIVATE()
|
|||
|
END_MESSAGE_MAP()
|
|||
|
|
|||
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
// Create control in same position as an existing static control with
|
|||
|
// the same ID (could be any kind of control, really)
|
|||
|
//
|
|||
|
BOOL CHtmlCtrl::CreateFromStatic(UINT nID, CWnd* pParent)
|
|||
|
{
|
|||
|
CStatic wndStatic;
|
|||
|
if (!wndStatic.SubclassDlgItem(nID, pParent))
|
|||
|
return FALSE;
|
|||
|
|
|||
|
// Get static control rect, convert to parent's client coords.
|
|||
|
CRect rc;
|
|||
|
wndStatic.GetWindowRect(&rc);
|
|||
|
pParent->ScreenToClient(&rc);
|
|||
|
wndStatic.DestroyWindow();
|
|||
|
|
|||
|
// create HTML control (CHtmlView)
|
|||
|
return Create(NULL, // class name
|
|||
|
NULL, // title
|
|||
|
(WS_CHILD | WS_VISIBLE ), // style
|
|||
|
rc, // rectangle
|
|||
|
pParent, // parent
|
|||
|
nID, // control ID
|
|||
|
NULL); // frame/doc context not used
|
|||
|
}
|
|||
|
|
|||
|
////////////////
|
|||
|
// Override to avoid CView stuff that assumes a frame.
|
|||
|
//
|
|||
|
void CHtmlCtrl::OnDestroy()
|
|||
|
{
|
|||
|
// This is probably unecessary since ~CHtmlView does it, but
|
|||
|
// safer to mimic CHtmlView::OnDestroy.
|
|||
|
if (m_pBrowserApp) {
|
|||
|
m_pBrowserApp.Release();
|
|||
|
m_pBrowserApp = NULL;
|
|||
|
}
|
|||
|
CWnd::OnDestroy(); // bypass CView doc/frame stuff
|
|||
|
}
|
|||
|
|
|||
|
////////////////
|
|||
|
// Override to avoid CView stuff that assumes a frame.
|
|||
|
//
|
|||
|
|
|||
|
int CHtmlCtrl::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT msg)
|
|||
|
{
|
|||
|
// bypass CView doc/frame stuff
|
|||
|
return CWnd::OnMouseActivate(pDesktopWnd, nHitTest, msg);
|
|||
|
}
|
|||
|
|