Colin.
You handle NewWindow2 event, create a new window that hosts WebBrowser
control and return it from the event handler. Now, this new window
should perform the following operations:
1. Sink the following events from WebBrowser: OnFullScreen, OnMenuBar,
OnStatusBar, OnToolBar, WindowSetResizable, OnVisible
Implement IOleCommandTarget on the same object that implements
IOleContainer. The details depend on the framework you use for hosting.
IOleCommandTarget::QueryInterface can simply return E_NOTIMPL. See the
description of IOleCommandTarget::Exec below
Initialize a set of boolean flags:
bFullScreen = false;
bStatusBar = bResizable = bToolBar = bToolBand = bAddressBar = bMenuBar
= true;
2. Handle OnFullScreen event, set bFullScreen equal to the value of
boolean parameter passed to this event
3. Handle OnStatusBar event, set bStatusBar equal to the value of
boolean parameter passed to this event
4. Handle WindowSetResizable event, set bResizable equal to the value of
boolean parameter passed to this event
5. Handle OnToolBar event, set bToolBar equal to the value of boolean
parameter passed to this event
6. Handle OnMenuBar event, set bMenuBar equal to the value of boolean
parameter passed to this event
7. Implement IOleCommandTarget::Exec in the following way:
STDMETHODIMP CTempDlg::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
{
if (pguidCmdGroup && *pguidCmdGroup == CGID_Explorer && nCmdID == 1)
{
if (LOWORD(nCmdExecOpt) == 0xA)
bToolBand = (HIWORD(nCmdExecOpt) != 0);
}
return OLECMDERR_E_NOTSUPPORTED;
}
CGID_Explorer is defined in <shlguid.h>.
8. OnVisible event with VARIANT_TRUE as the parameter will come after
all the other events have fired. At this point, you have all the
necessary information to construct UI elements. Do the following.
8.1. Call IWebBrowser2::get_AddressBar, set bAddressBar flag to the
result of this call (OnAddressBar event is never fired)
8.2 If bToolBar == false, set
m_bToolBand = m_bAddressBar = m_bMenuBar = false;
For some reason unclear to me, OnToolBar(TRUE) is fired when any of
toolbar, address bar or menu bar are requested. If OnToolBar(FALSE) is
fired, none of those three should be shown, even though some events
contradict this. To figure out whether or not toolbar proper needs to be
shown you have to implement IOleCommandTarget::Exec hack.
8.3. Now you are ready to show your window. bFullScreen indicates
whether or not it should open in FullScreen mode, bStatusBar indicates
the presence of the status bar, bResizable indicates whether or not it
should be resizable, bToolBand (not bToolBar) indicates the presence of
the tool bar, bAddressBar indicates the presence of address bar,
bMenuBar indicates the presence of menu bar.
NOTES: a) events 2 through 7 can arrive in any order, not necessarily in
the order shown. OnVisible(TRUE) will only get fired after all the
others have fired, so you have all the necessary information.
b) WindowSetResizable is only fired by IE5.5 and later.
IWebBrowser2::get_Resizable returns E_NOTIMPL in all browser versions.
There appears to be no way to detect the setting of "resizable" feature
in IE4 and IE5. Even MSN Explorer (developed by MS) does not honor it if
installed over IE5.
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
"Colin Messitt" <co...@removethistomailme.smartcode.com> wrote in
message news:uO0$U6J5BHA.2748@tkmsftngp07...
Colin.
"Igor Tandetnik" <itand...@whenu.com> wrote in message
news:u09m8eK5BHA.1804@tkmsftngp02...