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.
pmuktiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrwad99Commented:
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
0
pmuktiAuthor Commented:
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.
0
mrwad99Commented:
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.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

pmuktiAuthor Commented:
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.
0
mrwad99Commented:
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.
0
mrwad99Commented:
Right then.  I created a basic dialogue application, then right clicked the dialogue in the resource editor, selected "Insert ActiveX control..." then selected Microsoft Web Browser.  VC++ gave the control the ID IDC_EXPLORER1 by default, which I left. You then need to create a wrapper class for the object, so right click the control, select classwizard, then member variables and select IDC_EXPLORER1 or whatever your control is called.  Then add a variable, accept the fact that you need to add wrapper classes, and the default file names for the classes, then give your browser a name something like m_wndBrowser.  

I then decided to handle the NavigateError message in the dialogue class that hosts the control, so I right click the class in the classview (here CGDlg), select IDC_EXPLORER1 as the control to handle, then select NavigateError, as shown at http://mrwad99.125mb.com/EG.jpg.  You can take it from there :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pmuktiAuthor Commented:
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.
0
mrwad99Commented:
>> 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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.