HtmlDlg.cpp
上传用户:zhadl198
上传日期:2009-06-12
资源大小:56k
文件大小:2k
- // HtmlDlg.cpp : 实现文件
- //
- #include "stdafx.h"
- #include "CWebHtmlTest.h"
- #include "HtmlDlg.h"
- #include ".htmldlg.h"
- // CHtmlDlg 对话框
- IMPLEMENT_DYNAMIC(CHtmlDlg, CDialog)
- CHtmlDlg::CHtmlDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CHtmlDlg::IDD, pParent)
- {
- }
- CHtmlDlg::~CHtmlDlg()
- {
- }
- void CHtmlDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- }
- BEGIN_MESSAGE_MAP(CHtmlDlg, CDialog)
- END_MESSAGE_MAP()
- // CHtmlDlg 消息处理程序
- BOOL CHtmlDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: 在此添加额外的初始化
-
- VARIANT vInfo;
- vInfo.vt=VT_EMPTY;
- CRect _winRect;
- GetClientRect(_winRect);
- m_pWebBrowser = new CWebBrowser2;
- //m_pWebBrowser->Create(NULL,WS_CHILD|WS_VISIBLE,CRect(1,1,_winRect.Width()-2,_winRect.Height()-2),this,IDC_WEBBROWSER,0,0,0);
- m_pWebBrowser->Create(NULL,WS_CHILD|WS_VISIBLE,CRect(1,1,_winRect.Width()-2,_winRect.Height()-2),this,0,0,0,0);
- //m_pWebBrowser->Navigate("http://www.seofan.cn/login.php?loginname=XXX&password=1234", &vInfo, &vInfo, &vInfo, &vInfo);
- m_pWebBrowser->Navigate("www.seofan.cn", &vInfo, &vInfo, &vInfo, &vInfo);
-
-
- return TRUE; // return TRUE unless you set the focus to a control
- // 异常: OCX 属性页应返回 FALSE
- }
- void CMyWebBrowser::OnDocumentComplete(LPCTSTR lpszURL)
- {
- if(!flag)
- {
- CComPtr<IDispatch> spDisp;
- spDisp = GetHtmlDocument();
- CComQIPtr<IHTMLDocument2> pDoc(spDisp);
- CComBSTR v /*= pMain->sCookie*/;
- if(pDoc)
- {
- pDoc->get_cookie(&v);
- if(v)
- {
- v.ToLower();
- _bstr_t bsTemp(v);
- char sHdr[300];
- sprintf(sHdr,"Referer:www.seofan.cn");//;%s",(char*)bsTemp);
- Navigate("http://www.seofan.cn/",0,0,sHdr);
- flag = 1;
- this->ShowWindow(SW_SHOW);
- }
- }
- }
- CHtmlView::OnDocumentComplete(lpszURL);
- }