mfc >> CHtmlView fails

by Andrius kys » Tue, 27 Apr 2004 00:57:58 GMT

I'm using MFC 7.0 CHtmlView to get a IHTMLDocument to dynamicly display HTML
content, the problem is that on my test computer (Windows 2000, Internet
Explorer 5.00.3700.1000) method put_innerHTML fails. It works fine with
Windows XP and Internet Explorer 6. Could someone please explain how to make
my code compatible with older versions of IE.

The code which displays HTML content

void CTapiCapsView::OnTapiCapsUpdate(const string& html)
{
IHTMLDocument2* doc = NULL;
IHTMLElement* body = NULL;
IDispatch* dispatch = GetHtmlDocument();
if (dispatch)
{
HRESULT hr = dispatch->QueryInterface(IID_IHTMLDocument2,
(void**)&doc);
dispatch->Release();
}
if (doc)
{
doc->get_body(&body);
doc->Release();
}
if (body)
{
CString x(html.c_str());
body->put_innerHTML(x.AllocSysString());
body->Release();
}
}

Andrius kys
XXXX@XXXXX.COM



Similar Threads

1. How to detect proxy failed or remote host failed

Hi All,

I have an application where I am accessing resources from internet/intranet. 
I am using HttpWebRequest/HttpWebResponse. The connection is made through 
proxy.

During error handling I want to detect if the connection is failed while 
accessing proxy or while accessing remote host. If proxy is failed I want to 
do proxy recovery. (In case multiple proxies are specified then fail over to 
another proxy), in case remote host is failed I just want report the error.

When I catch WebException, the status of WebException in both the cases 
(when proxy is down or remote host is down) is ConnectFailure.

According to MSDN help, if status == ConnectFailure then proxy or firewall 
is failed, but this is not true. I checked by making direct connection 
(without proxy) and if my remote host is down still I get ConnectFailure.

According to MSDN help, HttpWebRequest.Address is suppose to return the 
actaul URL that has responded but I checked even when my proxy is down still 
the HttpWebRequest.Address is the original address pointing to remote host.

I checked the InnerException of the WebException I am getting,it clearly 
showes two different error messages when proxy is down and host is down.

Can anybody help me in detecting if proxy is failed or remote host ? 

2. TransactionEscope Fails - When NetWork Connections Fails (ORACLE) - CSharp/C#

3. CDataExchange::Fail() fails

When I try to call CDataExchange::Fail() function in my member I get the 
following list of errors.

<ERRORS>
error C2059: syntax error : 'constant'
error C2039: 'func1' : is not a member of 'CDataExchange'
error C2039: 'func2' : is not a member of 'CDataExchange'
error C2039: 'AfxMessageBox' : is not a member of 'CDataExchange'
error C2039: 'pDX' : is not a member of 'CDataExchange'
</ERRORS>

The problematic code is below.

<CODE>
CFoo::MyDDV( CDataExchange* pDX )
{
 if( pDX->m_bSaveAndValidate )
 {
  if( ! func1() )
    {
   AfxMessageBox( "ERROR.", MB_ICONEXCLAMATION );
      pDX->Fail();
    }

 }

}
</CODE>

What is wrong?

Thanks 

4. CDataExchange::Fail() fails

5. Debug assertion failed but not failed in release version

Hi

i got "debug assertion failed" in debug version while not get in
release version .

i created dialog box in thread in thread in that i pass parent HWND

when i call "DoModal()" it failed

it failed in WINCORE.CPP at
    		ASSERT((CWnd*)p == this);   // must be us
line,

as i know ,in release version all ASSERT statement are not considered
(compiled) so i am not got in release.

Is there any solution for dubug version ???

thanks in advance

will it create any problem in release version  ???

p2

6. [MFC] CDataExchange::Fail() fails

7. Searching for something like CHtmlView inside VC++

Hallo,

in some of my application I developed with VC++ I used CHtmlView for
formated text output based on HTML. In the current .NET application I need
something similar inside C#. But I can't find it.
Who knows the missing class?

Thanks in advance
Bernd


8. CHtmlView zoom in/out images