tags:

views:

26

answers:

1

I can't google for C++ for some reason, like it ignores ++ completely and returns me stuff on C#.

That aside, I have never used Visual C++ before (Windows Forms app) and I can't figure out how to catch any errors in the WebBrowser.

I'd like to pop up a message saying that the server is offline and exit the application if navigation cancels, DNS fails to resolve somehow, connection times out, or connection is reset - I haven't even messed around in code yet, only in the design tab.

This is what's in code right now:

this->appPushUI->AllowWebBrowserDrop = false;
this->appPushUI->IsWebBrowserContextMenuEnabled = false;
this->appPushUI->Location = System::Drawing::Point(0, 0);
this->appPushUI->MinimumSize = System::Drawing::Size(20, 20);
this->appPushUI->Name = L"appPushUI";
this->appPushUI->ScriptErrorsSuppressed = false;
this->appPushUI->ScrollBarsEnabled = true;
this->appPushUI->Size = System::Drawing::Size(735, 329);
this->appPushUI->TabIndex = 1;
this->appPushUI->Url = (gcnew System::Uri(L"http://10.4.156.54/risk/Default.aspx", System::UriKind::Absolute));
this->appPushUI->DocumentCompleted += gcnew System::Windows::Forms::WebBrowserDocumentCompletedEventHandler(this, &Form1::appPushUI_DocumentCompleted);

Any help at all would be greatly appreciated.

A: 

Unless you have a spefic need to use C++, I would highly recommend to use a .NET language like C# or VB.NET to program the browser control. It is almost as powerful and much easier.

For your question, maybe it fails because the webbrowser control loads the default error page (so there is a page load event even so the real website is unreachable).

Ruby8848