corrected error handling if no web control could be found

svn path=/trunk/; revision=8083
This commit is contained in:
Martin Fuchs 2004-02-07 19:04:03 +00:00
parent 36f96a21b7
commit 73b7358882
4 changed files with 20 additions and 16 deletions

View file

@ -3,7 +3,7 @@
<tr>
<td><address style="align: right;"><small>
ROS Explorer Source Code Documentation
<br>generated on 05.02.2004 by <a href="http://www.doxygen.org/index.html">
<br>generated on 07.02.2004 by <a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0>
</small></address>
</td>

View file

@ -186,7 +186,9 @@ static const CLSID CLSID_MozillaBrowser =
WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info)
: super(hwnd)
: super(hwnd),
_evt_handler1(NULL),
_evt_handler2(NULL)
{
// first try to create MS IE web control
HRESULT hr = create_control(hwnd, CLSID_WebBrowser, IID_IWebBrowser2);
@ -197,24 +199,24 @@ WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info)
if (SUCCEEDED(hr)) {
// handling events using DWebBrowserEvents
_evt_demo1 = new DWebBrowserEventsHandler(_hwnd, _control);
_evt_handler1 = new DWebBrowserEventsHandler(_hwnd, _control);
// handling events using DWebBrowserEvents2
_evt_demo2 = new DWebBrowserEvents2Handler(_hwnd, _control);
}
_evt_handler2 = new DWebBrowserEvents2Handler(_hwnd, _control);
SIfacePtr<IWebBrowser2> browser(get_browser());
SIfacePtr<IWebBrowser2> browser(get_browser());
#ifdef __MINGW32__ // MinGW is lacking vtMissing (as of 07.02.2004)
Variant vtMissing;
Variant vtMissing;
#endif
browser->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
//browser->Navigate2(&Variant(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
browser->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
//browser->Navigate2(&Variant(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
}
}
WebChildWindow::~WebChildWindow()
{
delete _evt_demo2;
delete _evt_demo1;
delete _evt_handler2;
delete _evt_handler1;
}

View file

@ -427,8 +427,11 @@ protected:
}
} else if (message == WM_CLOSE) {
_in_place_object = NULL;
_client_side.detach(SIfacePtr<IOleObject>(_control, IID_IOleObject), OLECLOSE_NOSAVE);
_control = NULL;
if (_control) {
_client_side.detach(SIfacePtr<IOleObject>(_control, IID_IOleObject), OLECLOSE_NOSAVE);
_control = NULL;
}
}
return super::WndProc(message, wparam, lparam);
@ -1356,6 +1359,6 @@ struct WebChildWindow : public IPCtrlWindow<ChildWindow, SIfacePtr<IWebBrowser2>
}
protected:
DWebBrowserEventsHandler* _evt_demo1;
DWebBrowserEvents2Handler* _evt_demo2;
DWebBrowserEventsHandler* _evt_handler1;
DWebBrowserEvents2Handler* _evt_handler2;
};

View file

@ -332,7 +332,6 @@ template<typename T> struct SIfacePtr
SIfacePtr(IUnknown* unknown, REFIID riid)
{
CHECKERROR(unknown->QueryInterface(riid, (LPVOID*)&_p));
//@@ _p->AddRef();
}
~SIfacePtr()