Link to home
Start Free TrialLog in
Avatar of mycraft
mycraft

asked on

Why does my CHtmlView crash on GoBack??

Hi folks,
I'm trying to figure out why the Webbrowser crashes when I try to go back even if it's "allowed".

My App looks like this: I've got a SDI-Window with a Splitterwindows. On the left side, there's a CTreeView filled with an ActiveX OCX. My ChtmlView is in the right pane.
When I start the prog, the CHtmlView navigates to title.htm.
Of course, I monitor OnCommmandStateChange...
Now, when I click something in the Treeview that makes the CHtmlView navigate, I can go back (using GoBack() ) without problems.
But if I click on a Link in the initial title.htm and then want to go back....CRASH. Looks like the CommandStateChange has been sent, though the CHtmlView isn't able to GoBack....

plz HELP


Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

can u add the relevant code please
Avatar of mycraft
mycraft

ASKER

OK, here's the relevant code.... though I think it won't help U...

void CSplitterHtmlView::OnCommandStateChange(long nCommand, BOOL bEnable)
{

     if (nCommand==CSC_NAVIGATEBACK)
          {
          CanBack=bEnable;
          }
     
     if (nCommand==CSC_NAVIGATEFORWARD)
          {
          CanForward=bEnable;
          }

     CHtmlView::OnCommandStateChange(nCommand, bEnable);
}

and when the user clicks "Forward" (pMyView is a pointer to the actual CSplitterHtmlView-Object; CSplitterHtmlView is derived from CHtmlView):

void CMainFrame::OnNext()
{
     if (CanForward) pMyView->GoForward();

     // TODO: Add your command handler code here
     
}

same for "Back"
ASKER CERTIFIED SOLUTION
Avatar of xu2000
xu2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial