晚上收集,使用是有效的
1、CDHtmlDialog如何设置自动滚动条
首先 SetHostFlags(DOCHOSTUIFLAG_NO3DBORDER|DOCHOSTUIFLAG_DIALOG);
然后在OnDocumentComplete(LPCTSTR lpszURL)里添加
IHTMLBodyElement *pBody;
IHTMLElement *pEle;
m_spHtmlDoc->get_body(&pEle);
HRESULT hr = pEle->QueryInterface(IID_IHTMLBodyElement,(void **)&pBody);
pBody->put_scroll(_T("auto"));
pBody->Release();
pEle->Release();
2、如何post提交数据
CHtmlView::Navigate2(_T("http://....."),0,NULL,_T("Content-Type: application/x-www-form-urlencoded\r\n")
,"data=data",strlen("data=data"));
}
"data=data"即为post的数据
源码见:
CHtmlView::Navigate2(LPCTSTR lpszURL, DWORD dwFlags /* = 0 */,
LPCTSTR lpszTargetFrameName /* = NULL */,
LPCTSTR lpszHeaders /* = NULL */,
LPVOID lpvPostData /* = NULL */, DWORD dwPostDataLen /* = 0 */)
{
ASSERT(m_pBrowserApp != NULL);
COleSafeArray vPostData;
if (lpvPostData != NULL)
{
if (dwPostDataLen == 0)
dwPostDataLen = lstrlen((LPCTSTR) lpvPostData);
vPostData.CreateOneDim(VT_UI1, dwPostDataLen, lpvPostData);
}
COleVariant vURL(lpszURL, VT_BSTR);
COleVariant vHeaders(lpszHeaders, VT_BSTR);
COleVariant vTargetFrameName(lpszTargetFrameName, VT_BSTR);
COleVariant vFlags((long) dwFlags, VT_I4);
m_pBrowserApp->Navigate2(vURL,
vFlags, vTargetFrameName, vPostData, vHeaders);
}
3、保存网页
VARIANT vn;
vn.vt = VT_BSTR;
vn.bstrVal = _T("c:\\tt.xml");
m_pBrowserApp->ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_DONTPROMPTUSER, &vn,NULL);