eliminated nasty warning message

svn path=/trunk/; revision=8138
This commit is contained in:
Martin Fuchs 2004-02-10 21:22:55 +00:00
parent 30462af124
commit 9f5e152d22
4 changed files with 32 additions and 17 deletions

View file

@ -623,8 +623,11 @@ int MainFrame::Command(int id, int code)
break;} break;}
case ID_WEB_WINDOW: case ID_WEB_WINDOW:
#ifdef _DEBUG
create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://localhost")));
#else
create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://www.reactos.com"))); create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://www.reactos.com")));
//create_webchildwindow(_hmdiclient, WebChildWndInfo(TEXT("http://localhost"))); #endif
break; break;
///@todo There are even more menu items! ///@todo There are even more menu items!

View file

@ -101,12 +101,16 @@ void BStr::assign(const VARIANT& var)
} }
BrowserNavigator::BrowserNavigator(IWebBrowser* browser) BrowserNavigator::BrowserNavigator()
: _browser(browser), : _browser_initialized(false)
_browser_initialized(false)
{ {
} }
void BrowserNavigator::attach(IWebBrowser* browser)
{
_browser = browser;
}
void BrowserNavigator::goto_url(LPCTSTR url) void BrowserNavigator::goto_url(LPCTSTR url)
{ {
if (_browser_initialized) if (_browser_initialized)
@ -198,18 +202,17 @@ WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info)
hr = create_control(hwnd, CLSID_MozillaBrowser, IID_IWebBrowser2); hr = create_control(hwnd, CLSID_MozillaBrowser, IID_IWebBrowser2);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
_navigator.attach(_control);
HWND hwndFrame = GetParent(info._hmdiclient); HWND hwndFrame = GetParent(info._hmdiclient);
// handling events using DWebBrowserEvents2 // handling events using DWebBrowserEvents2
_evt_handler = auto_ptr<DWebBrowserEvents2Handler>(new DWebBrowserEvents2Handler(_hwnd, hwndFrame, _control)); _evt_handler = auto_ptr<DWebBrowserEvents2Handler>(new DWebBrowserEvents2Handler(_hwnd, hwndFrame, _navigator));
SIfacePtr<IWebBrowser2> browser(get_browser());
#ifdef __MINGW32__ // MinGW is lacking vtMissing (as of 07.02.2004) #ifdef __MINGW32__ // MinGW is lacking vtMissing (as of 07.02.2004)
Variant vtMissing; Variant vtMissing;
#endif #endif
get_browser()->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
browser->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
//browser->Navigate2(&Variant(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); //browser->Navigate2(&Variant(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
} }
} }

View file

@ -569,12 +569,15 @@ struct DWebBrowserEvents2IF
// die nicht auf das Internet zugreift (z.B. addcom/./index.html) dargestellt werden kann. // die nicht auf das Internet zugreift (z.B. addcom/./index.html) dargestellt werden kann.
struct ANSUNC BrowserNavigator struct ANSUNC BrowserNavigator
{ {
BrowserNavigator(IWebBrowser* browser); BrowserNavigator();
void attach(IWebBrowser* browser);
void goto_url(LPCTSTR url); void goto_url(LPCTSTR url);
void set_html_page(const String& html_txt); void set_html_page(const String& html_txt);
void navigated(LPCTSTR url); void navigated(LPCTSTR url);
IWebBrowser* get_browser() {return _browser.get();}
protected: protected:
SIfacePtr<IWebBrowser> _browser; SIfacePtr<IWebBrowser> _browser;
String _new_url; String _new_url;
@ -889,13 +892,13 @@ struct DWebBrowserEvents2Handler : public DWebBrowserEvents2Impl
{ {
typedef DWebBrowserEvents2Impl super; typedef DWebBrowserEvents2Impl super;
DWebBrowserEvents2Handler(HWND hwnd, HWND hwndFrame, IWebBrowser* browser) DWebBrowserEvents2Handler(HWND hwnd, HWND hwndFrame, BrowserNavigator& navigator)
: _hwnd(hwnd), : DWebBrowserEvents2Impl(navigator),
_hwnd(hwnd),
_hwndFrame(hwndFrame), _hwndFrame(hwndFrame),
_navigator(browser), _navigator(navigator),
DWebBrowserEvents2Impl(_navigator), _browser(navigator.get_browser(), IID_IWebBrowser2),
_browser(browser, IID_IWebBrowser2), _connector(navigator.get_browser(), DIID_DWebBrowserEvents2, this)
_connector(browser, DIID_DWebBrowserEvents2, this)
{ {
} }
@ -1058,7 +1061,7 @@ protected:
protected: protected:
HWND _hwnd; HWND _hwnd;
HWND _hwndFrame; HWND _hwndFrame;
BrowserNavigator _navigator; BrowserNavigator& _navigator;
SIfacePtr<IWebBrowser2> _browser; SIfacePtr<IWebBrowser2> _browser;
EventConnector _connector; EventConnector _connector;
}; };
@ -1087,6 +1090,7 @@ struct WebChildWindow : public IPCtrlWindow<ChildWindow, SIfacePtr<IWebBrowser2>
} }
protected: protected:
BrowserNavigator _navigator;
auto_ptr<DWebBrowserEvents2Handler> _evt_handler; auto_ptr<DWebBrowserEvents2Handler> _evt_handler;
LRESULT WndProc(UINT message, WPARAM wparam, LPARAM lparam); LRESULT WndProc(UINT message, WPARAM wparam, LPARAM lparam);

View file

@ -405,6 +405,11 @@ template<typename T> struct SIfacePtr
return _p->QueryInterface(riid, (LPVOID*)p); return _p->QueryInterface(riid, (LPVOID*)p);
} }
T* get()
{
return _p;
}
void Free() void Free()
{ {
T* h = _p; T* h = _p;