display nice error message

svn path=/trunk/; revision=8084
This commit is contained in:
Martin Fuchs 2004-02-07 19:51:53 +00:00
parent 73b7358882
commit 77d84e17ca
3 changed files with 24 additions and 2 deletions

View file

@ -611,7 +611,7 @@ int MainFrame::Command(int id, int code)
break;}
case ID_WEB_WINDOW:
create_webchildwindow(_hmdiclient, WebChildWndInfo(TEXT("http://www.reactos.com"))); //@@
create_webchildwindow(_hmdiclient, WebChildWndInfo(TEXT("http://localhost"))); // http://www.reactos.com //@@
break;
///@todo There are even more menu items!

View file

@ -190,7 +190,7 @@ WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info)
_evt_handler1(NULL),
_evt_handler2(NULL)
{
// first try to create MS IE web control
// first try to create a web control with MS IE's CLASSID
HRESULT hr = create_control(hwnd, CLSID_WebBrowser, IID_IWebBrowser2);
// If this failed, try to use Mozilla's web control
@ -220,3 +220,23 @@ WebChildWindow::~WebChildWindow()
delete _evt_handler2;
delete _evt_handler1;
}
LRESULT WebChildWindow::WndProc(UINT message, WPARAM wparam, LPARAM lparam)
{
if (message == WM_ERASEBKGND) {
if (!_control) {
HDC hdc = (HDC)wparam;
ClientRect rect(_hwnd);
HBRUSH hbrush = CreateSolidBrush(RGB(200,200,235));
BkMode mode(hdc, TRANSPARENT);
TextColor color(hdc, RGB(200,40,40));
FillRect(hdc, &rect, hbrush);
DrawText(hdc, TEXT("Sorry - no web browser control could be loaded."), -1, &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
DeleteObject(hbrush);
}
return TRUE;
} else
return super::WndProc(message, wparam, lparam);
}

View file

@ -1361,4 +1361,6 @@ struct WebChildWindow : public IPCtrlWindow<ChildWindow, SIfacePtr<IWebBrowser2>
protected:
DWebBrowserEventsHandler* _evt_handler1;
DWebBrowserEvents2Handler* _evt_handler2;
LRESULT WndProc(UINT message, WPARAM wparam, LPARAM lparam);
};