Using CWebBrowser2 control with CString?
-
Hello, i use this control in dialog based application and i want to assign a CString value to them! I mean, show html content without calling .Navigate(...);
// sample
CString csHtmlContent = L"some very large text";
CWebBrowserCtrl2 cWeb;
// here assign CString-value to cWeb!Is that possible, any suggestion for this problem? It can be any other control who can show html content! Thanks for any help! termal
-
Hello, i use this control in dialog based application and i want to assign a CString value to them! I mean, show html content without calling .Navigate(...);
// sample
CString csHtmlContent = L"some very large text";
CWebBrowserCtrl2 cWeb;
// here assign CString-value to cWeb!Is that possible, any suggestion for this problem? It can be any other control who can show html content! Thanks for any help! termal
You can write the HTML text into a temporary file and open that file in your web control using Navigate method by prefixing file:// in its URL.
cheers Varghese Paul
-
You can write the HTML text into a temporary file and open that file in your web control using Navigate method by prefixing file:// in its URL.
cheers Varghese Paul
-
Hello, i use this control in dialog based application and i want to assign a CString value to them! I mean, show html content without calling .Navigate(...);
// sample
CString csHtmlContent = L"some very large text";
CWebBrowserCtrl2 cWeb;
// here assign CString-value to cWeb!Is that possible, any suggestion for this problem? It can be any other control who can show html content! Thanks for any help! termal
Some thing like this,
CComPtr<IDispatch> pDispDoc; CComVariant spVar(\_T("about:blank")); m\_Explorer.Navigate2(&spVar, 0, 0, 0, 0); // Just to initialise a blank doc **pDispDoc = m\_Explorer.get\_Document();** CComQIPtr<IHTMLDocument2> spDoc(pDispDoc); VARIANT \*param; **CComBSTR spbStrHtmlText(OLESTR("<html><body>some very large text</body></html>"));** SAFEARRAY \* psfArray = SafeArrayCreateVector(VT\_VARIANT, 0, 1); SafeArrayAccessData(psfArray,(LPVOID\*) & param); param->vt = VT\_BSTR; param->bstrVal = spbStrHtmlText; SafeArrayUnaccessData(psfArray); **spDoc->write(psfArray);** SafeArrayDestroy(psfArray);
See also [IHTMLElement::innerHTML ^] And have a look at IHTMLDom objects to have more controls over internal html nodes.
-
Some thing like this,
CComPtr<IDispatch> pDispDoc; CComVariant spVar(\_T("about:blank")); m\_Explorer.Navigate2(&spVar, 0, 0, 0, 0); // Just to initialise a blank doc **pDispDoc = m\_Explorer.get\_Document();** CComQIPtr<IHTMLDocument2> spDoc(pDispDoc); VARIANT \*param; **CComBSTR spbStrHtmlText(OLESTR("<html><body>some very large text</body></html>"));** SAFEARRAY \* psfArray = SafeArrayCreateVector(VT\_VARIANT, 0, 1); SafeArrayAccessData(psfArray,(LPVOID\*) & param); param->vt = VT\_BSTR; param->bstrVal = spbStrHtmlText; SafeArrayUnaccessData(psfArray); **spDoc->write(psfArray);** SafeArrayDestroy(psfArray);
See also [IHTMLElement::innerHTML ^] And have a look at IHTMLDom objects to have more controls over internal html nodes.
-
Some thing like this,
CComPtr<IDispatch> pDispDoc; CComVariant spVar(\_T("about:blank")); m\_Explorer.Navigate2(&spVar, 0, 0, 0, 0); // Just to initialise a blank doc **pDispDoc = m\_Explorer.get\_Document();** CComQIPtr<IHTMLDocument2> spDoc(pDispDoc); VARIANT \*param; **CComBSTR spbStrHtmlText(OLESTR("<html><body>some very large text</body></html>"));** SAFEARRAY \* psfArray = SafeArrayCreateVector(VT\_VARIANT, 0, 1); SafeArrayAccessData(psfArray,(LPVOID\*) & param); param->vt = VT\_BSTR; param->bstrVal = spbStrHtmlText; SafeArrayUnaccessData(psfArray); **spDoc->write(psfArray);** SafeArrayDestroy(psfArray);
See also [IHTMLElement::innerHTML ^] And have a look at IHTMLDom objects to have more controls over internal html nodes.
Hello, i have just one little question about this, if i try to show next html content, that is append to existing content, so i have two sites showed in this control! :doh: I think i should before i show next content, clear the existing text, but how, can you help me again with that? regards termal
-
Hello, i have just one little question about this, if i try to show next html content, that is append to existing content, so i have two sites showed in this control! :doh: I think i should before i show next content, clear the existing text, but how, can you help me again with that? regards termal