#import <SHDOCVW.DLL> rename_namespace ( "IE" ) named_guids
#include <mshtml.h>
#include <comdef.h>

class CDlgWebBrowser : public CDialog
{

protected:
	IE::IWebBrowser2* m_pWebBrowser;
	CWnd m_wndBrowser;

};

int CDlgWebBrowser::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	AfxEnableControlContainer();
	if (!m_wndBrowser.CreateControl(CLSID_WebBrowser, NULL, WS_VISIBLE|WS_CHILD, CRect(0, 0, 10, 10), this, AFX_IDW_PANE_FIRST))
	{	
		return -1;
	}

	LPUNKNOWN lpUnk = m_wndBrowser.GetControlUnknown();
	HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pWebBrowser);
	if (!SUCCEEDED(hr))
	{
		m_pWebBrowser = NULL;
		m_wndBrowser.DestroyWindow();
		return -1;
	}

	return 0;
}

void CDlgWebBrowser::OnDestroy() 
{
	CDialog::OnDestroy();
	if (m_pWebBrowser)
	{
		m_pWebBrowser->Release();
		m_pWebBrowser = NULL;
	}
}

void CDlgWebBrowser::OnSize(UINT nType, int cx, int cy) 
{
	(—ª)
	m_wndBrowser.SetWindowPos(NULL, x, y, wx, wy, SWP_NOOWNERZORDER|SWP_NOZORDER);
}

m_pWebBrowser->Navigate2(URL•¶Žš—ñ);

‚u‚bŠo‘‚«ƒy[ƒW...