Link to home
Start Free TrialLog in
Avatar of pmukti
pmukti

asked on

Help with WEb browser in MFC Application

Hello grp members,

 I am using web browser control in my mfc application. Now the problem is when i am navigate any page in it. if that page is failed to load. How can  i get it programmatically. means if i get the error like page cannot be displayed. How can I detect this message.

Can anybody help me out in this small problem?

Hoping for the solution...

Mukti.
Avatar of mrwad99
mrwad99
Flag of United Kingdom of Great Britain and Northern Ireland image

I have done a lot of work with the web browser control, and the way you handle this is by handling the message NavigateError.  See http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/dwebbrowserevents2/navigateerror.asp for exact details.

HTH
Avatar of pmukti
pmukti

ASKER

Hello,

Thank you very much for your response.
the problem is that
I can see the event available in webbrowser control in its help file but when I add the control in program and see its event list. i can't be able to see this event.
Can you explain it with some step. I can see the beforeNaviage2, etc event in the event list.
How can I add this event in my program?

I had tried to manually add this event but not get success.
Once you have added the control, and created the wrapper class (by double clicking the control in the dialogue editor - VC++ will prompt you to add a wrapper class) you need to open the class which you want to handle this message (say your dialogue class that contains the control) in the classview (left hand side of MSVC++), right click and then select "Add windows message handler".  Then select to handle the web browser object in the list box that appears in the dialogue, under "Select object to handle", then the events for the browser will appear in the large list box on the left.
Avatar of pmukti

ASKER

Hello ,

Thank you very much for your step guideline. That is true how to add event of web browser control in dialog editor.what I want to tell you is, there is no "NaviageError" function in event list.
Do you think that the control I am using which is not supporting this event?  May be the version is different.
What is ur comment?

Mukti.
Hmm, that is strange.  I don't have VC++ with me currently, so I will look this up later.  Are you sure there is no event like this listed, not even something like "OnNavigateError" ?  The message name may also be ended with the name of the browser control you have added to the dialogue, eg if your control is Browser then the message handler could be

OnNavigateErrorBrowser

Either way I will get back to you about this.
ASKER CERTIFIED SOLUTION
Avatar of mrwad99
mrwad99
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of pmukti

ASKER

Hello,

Thank you very much for your help. I had tried the same thing in some other system where I am getting NavigateError event even after doing the same process done in prev. system. so may be the problem is that the Webbrowser control version is different so that's why I am not able to see this.
Again Thank you very much for yr time and support.


Mukti.
>> I had tried the same thing in some other system

You would need to open up the WebBrowser activeX control and see what version you have on both systems to clarify that.  Glad to help anyway.