<code> <!- just for this posting ->
<html>
<head>
<title>HTMLPAGE2.htm</title>
</head>
<body>
<P id="hello">Hello World</P>
<form id="ScanRequest" method="post">
<INPUT id="Submit1" type="submit" value="Submit" name="Submit1">
</form>
</body>
</html>
</code>
When the submit button is replaced, I want to replace the displayed code
with new html, so in my OnBeforeNavigate2 member I have this code:
void CHTMLTest2View::OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags,
LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders,
BOOL* pbCancel)
{
IHTMLElement* pBody = NULL;
CComQIPtr<IHTMLDocument2> pDoc = GetHtmlDocument();
if(pDoc)
{
BSTR oldbody;
pDoc->get_body(&pBody);
CComBSTR newbody("<body><br><br>goodbye world</body>");
pBody->get_innerHTML(&oldbody);
CString strold(oldbody);
HRESULT hr = pBody->put_innerHTML((BSTR)newbody); // hr always is equal
to S_OK after the submit
pBody->Release();
}
// Calling the base class doesn't seem to make a difference, I've tried it
with and without the next statement
// CHtmlView::OnBeforeNavigate2(lpszURL, nFlags, lpszTargetFrameName,
baPostedData, lpszHeaders, pbCancel);
}
Everything I've read seems to imply that this code should change the
displayed view on the SDI app, but nothing is happening. I've moved this
code around in some of the other functions, but nothing seems to work. What
simple thing am I failing to grasp?? I want to be able to change the
display with loading new html and reloading if that's possible.
Thanks,
Jim Howard
*pbCancel = TRUE;
--
Jeff Partch [VC++ MVP]
"Jim Howard" <jn...@spamcop.net> wrote in message
news:u3IFL3xyCHA.2600@TK2MSFTNGP11...
THAT WAS IT!!!!!! I had a "d'oh" moment as soon as I saw it. Now my code
works just as I hoped!
Thank you so much.
Jim Howard
"Jeff Partch" <je...@mvps.org> wrote in message
news:e6bf#ByyCHA.1776@TK2MSFTNGP09...