[BROWSEUI:FORMATTING]

- Improve coding style (break long lines, use C++ casts, add comments, ...). Patch by Katayama Hirofumi MZ.
COTE-7121

svn path=/trunk/; revision=58877
This commit is contained in:
Thomas Faber 2013-04-28 07:49:41 +00:00
parent ec77a7ee25
commit d0ad4929d7
28 changed files with 995 additions and 757 deletions

View file

@ -55,12 +55,13 @@ HRESULT STDMETHODCALLTYPE CACLMulti::Append(IUnknown *punk)
if (punk == NULL) if (punk == NULL)
return E_FAIL; return E_FAIL;
fObjects = reinterpret_cast<struct ACLMultiSublist *>(CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * (fObjectCount + 1))); fObjects = reinterpret_cast<ACLMultiSublist *>(
CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * (fObjectCount + 1)));
fObjects[fObjectCount].punk = punk; fObjects[fObjectCount].punk = punk;
punk->AddRef(); punk->AddRef();
if (FAILED(punk->QueryInterface(IID_IEnumString, (void **)&fObjects[fObjectCount].pEnum))) if (FAILED(punk->QueryInterface(IID_IEnumString, reinterpret_cast<void **>(&fObjects[fObjectCount].pEnum))))
fObjects[fObjectCount].pEnum = NULL; fObjects[fObjectCount].pEnum = NULL;
if (FAILED(punk->QueryInterface(IID_IACList, (void **)&fObjects[fObjectCount].pACL))) if (FAILED(punk->QueryInterface(IID_IACList, reinterpret_cast<void **>(&fObjects[fObjectCount].pACL))))
fObjects[fObjectCount].pACL = NULL; fObjects[fObjectCount].pACL = NULL;
fObjectCount++; fObjectCount++;
return S_OK; return S_OK;
@ -75,9 +76,10 @@ HRESULT STDMETHODCALLTYPE CACLMulti::Remove(IUnknown *punk)
if (fObjects[i].punk == punk) if (fObjects[i].punk == punk)
{ {
release_obj(&fObjects[i]); release_obj(&fObjects[i]);
memmove(&fObjects[i], &fObjects[i + 1], (fObjectCount - i - 1) * sizeof(struct ACLMultiSublist)); MoveMemory(&fObjects[i], &fObjects[i + 1], (fObjectCount - i - 1) * sizeof(ACLMultiSublist));
fObjectCount--; fObjectCount--;
fObjects = reinterpret_cast<struct ACLMultiSublist *>(CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * fObjectCount)); fObjects = reinterpret_cast<ACLMultiSublist *>(
CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * fObjectCount));
return S_OK; return S_OK;
} }

View file

@ -61,14 +61,14 @@ private:
public: public:
DECLARE_REGISTRY_RESOURCEID(IDR_ACLMULTI) DECLARE_REGISTRY_RESOURCEID(IDR_ACLMULTI)
DECLARE_NOT_AGGREGATABLE(CACLMulti) DECLARE_NOT_AGGREGATABLE(CACLMulti)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CACLMulti) BEGIN_COM_MAP(CACLMulti)
COM_INTERFACE_ENTRY_IID(IID_IEnumString, IEnumString) COM_INTERFACE_ENTRY_IID(IID_IEnumString, IEnumString)
COM_INTERFACE_ENTRY_IID(IID_IACList, IACList) COM_INTERFACE_ENTRY_IID(IID_IACList, IACList)
COM_INTERFACE_ENTRY_IID(IID_IObjMgr, IObjMgr) COM_INTERFACE_ENTRY_IID(IID_IObjMgr, IObjMgr)
END_COM_MAP() END_COM_MAP()
}; };

View file

@ -110,11 +110,14 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
fSite.Release(); fSite.Release();
if (pUnkSite == NULL) if (pUnkSite == NULL)
return S_OK; return S_OK;
hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, (void **)&fSite);
hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&fSite));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
// get window handle of parent
parentWindow = NULL; parentWindow = NULL;
hResult = pUnkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow); hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (SUCCEEDED(hResult)) if (SUCCEEDED(hResult))
{ {
oleWindow->GetWindow(&parentWindow); oleWindow->GetWindow(&parentWindow);
@ -123,23 +126,29 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
if (!::IsWindow(parentWindow)) if (!::IsWindow(parentWindow))
return E_FAIL; return E_FAIL;
// create combo box ex
toolbar = CreateWindowEx(WS_EX_TOOLWINDOW, WC_COMBOBOXEXW, NULL, WS_CHILD | WS_VISIBLE | toolbar = CreateWindowEx(WS_EX_TOOLWINDOW, WC_COMBOBOXEXW, NULL, WS_CHILD | WS_VISIBLE |
WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY,
0, 0, 500, 250, parentWindow, (HMENU)0xa205, _AtlBaseModule.GetModuleInstance(), 0); 0, 0, 500, 250, parentWindow, (HMENU)0xa205, _AtlBaseModule.GetModuleInstance(), 0);
if (toolbar == NULL) if (toolbar == NULL)
return E_FAIL; return E_FAIL;
SubclassWindow(toolbar); SubclassWindow(toolbar);
SendMessage(CBEM_SETEXTENDEDSTYLE, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT);
fEditControl = (HWND)SendMessage(CBEM_GETEDITCONTROL, 0, 0); SendMessage(CBEM_SETEXTENDEDSTYLE,
fComboBox = (HWND)SendMessage(CBEM_GETCOMBOCONTROL, 0, 0); CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT);
fEditControl = reinterpret_cast<HWND>(SendMessage(CBEM_GETEDITCONTROL, 0, 0));
fComboBox = reinterpret_cast<HWND>(SendMessage(CBEM_GETCOMBOCONTROL, 0, 0));
#if 1 #if 1
hResult = CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER, IID_IAddressEditBox, (void **)&fAddressEditBox); hResult = CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER,
IID_IAddressEditBox, reinterpret_cast<void **>(&fAddressEditBox));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
#else #else
// instantiate new version // instantiate new version
#endif #endif
hResult = fAddressEditBox->QueryInterface(IID_IShellService, (void **)&shellService);
hResult = fAddressEditBox->QueryInterface(IID_IShellService, reinterpret_cast<void **>(&shellService));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = fAddressEditBox->Init(toolbar, fEditControl, 8, pUnkSite /*(IAddressBand *)this*/ ); hResult = fAddressEditBox->Init(toolbar, fEditControl, 8, pUnkSite /*(IAddressBand *)this*/ );
@ -153,17 +162,21 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
fGoButtonShown = true; fGoButtonShown = true;
shellInstance = GetModuleHandle(_T("shell32.dll")); shellInstance = GetModuleHandle(_T("shell32.dll"));
normalImagelist = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_NORMAL), 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION); normalImagelist = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_NORMAL),
hotImageList = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_HOT), 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION); 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
hotImageList = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_HOT),
20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
fGoButton = CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAMEW, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TBSTYLE_LIST | fGoButton = CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAMEW, 0, WS_CHILD | WS_CLIPSIBLINGS |
TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE, WS_CLIPCHILDREN | TBSTYLE_LIST | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NODIVIDER |
CCS_NOPARENTALIGN | CCS_NORESIZE,
0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL); 0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0); SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
SendMessage(fGoButton, TB_SETIMAGELIST, 0, (LPARAM)normalImagelist); SendMessage(fGoButton, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(normalImagelist));
SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, (LPARAM)hotImageList); SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, reinterpret_cast<LPARAM>(hotImageList));
SendMessage(fGoButton, TB_ADDSTRINGW, (WPARAM)_AtlBaseModule.GetResourceInstance(), IDS_GOBUTTONLABEL); SendMessage(fGoButton, TB_ADDSTRINGW,
reinterpret_cast<WPARAM>(_AtlBaseModule.GetResourceInstance()), IDS_GOBUTTONLABEL);
SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM)&buttonInfo); SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM)&buttonInfo);
return hResult; return hResult;
@ -201,7 +214,8 @@ HRESULT STDMETHODCALLTYPE CAddressBand::CloseDW(DWORD dwReserved)
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CAddressBand::ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) HRESULT STDMETHODCALLTYPE CAddressBand::ResizeBorderDW(
const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -218,18 +232,20 @@ HRESULT STDMETHODCALLTYPE CAddressBand::ShowDW(BOOL fShow)
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CAddressBand::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) HRESULT STDMETHODCALLTYPE CAddressBand::QueryStatus(
const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
{ {
CComPtr<IOleCommandTarget> oleCommandTarget; CComPtr<IOleCommandTarget> oleCommandTarget;
HRESULT hResult; HRESULT hResult;
hResult = fAddressEditBox->QueryInterface(IID_IOleCommandTarget, (void **)&oleCommandTarget); hResult = fAddressEditBox->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
return oleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText); return oleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
} }
HRESULT STDMETHODCALLTYPE CAddressBand::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) HRESULT STDMETHODCALLTYPE CAddressBand::Exec(const GUID *pguidCmdGroup,
DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{ {
// incomplete // incomplete
return E_NOTIMPL; return E_NOTIMPL;
@ -255,16 +271,17 @@ HRESULT STDMETHODCALLTYPE CAddressBand::UIActivateIO(BOOL fActivate, LPMSG lpMsg
if (fActivate) if (fActivate)
{ {
hResult = fSite->QueryInterface(IID_IInputObjectSite, (void **)&inputObjectSite); hResult = fSite->QueryInterface(IID_IInputObjectSite, reinterpret_cast<void **>(&inputObjectSite));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = inputObjectSite->OnFocusChangeIS((IDeskBand *)this, fActivate); hResult = inputObjectSite->OnFocusChangeIS(static_cast<IDeskBand *>(this), fActivate);
SetFocus(); SetFocus();
} }
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(
HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{ {
CComPtr<IWinEventHandler> winEventHandler; CComPtr<IWinEventHandler> winEventHandler;
HRESULT hResult; HRESULT hResult;
@ -282,7 +299,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
} }
break; break;
} }
hResult = fAddressEditBox->QueryInterface(IID_IWinEventHandler, (void **)&winEventHandler); hResult = fAddressEditBox->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
return winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult); return winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
@ -293,7 +310,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::IsWindowOwner(HWND hWnd)
CComPtr<IWinEventHandler> winEventHandler; CComPtr<IWinEventHandler> winEventHandler;
HRESULT hResult; HRESULT hResult;
hResult = fAddressEditBox->QueryInterface(IID_IWinEventHandler, (void **)&winEventHandler); hResult = fAddressEditBox->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
return winEventHandler->IsWindowOwner(hWnd); return winEventHandler->IsWindowOwner(hWnd);
@ -304,7 +321,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::FileSysChange(long param8, long paramC)
CComPtr<IAddressBand> addressBand; CComPtr<IAddressBand> addressBand;
HRESULT hResult; HRESULT hResult;
hResult = fAddressEditBox->QueryInterface(IID_IAddressBand, (void **)&addressBand); hResult = fAddressEditBox->QueryInterface(IID_IAddressBand, reinterpret_cast<void **>(&addressBand));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
return addressBand->FileSysChange(param8, paramC); return addressBand->FileSysChange(param8, paramC);
@ -315,7 +332,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::Refresh(long param8)
CComPtr<IAddressBand> addressBand; CComPtr<IAddressBand> addressBand;
HRESULT hResult; HRESULT hResult;
hResult = fAddressEditBox->QueryInterface(IID_IAddressBand, (void **)&addressBand); hResult = fAddressEditBox->QueryInterface(IID_IAddressBand, reinterpret_cast<void **>(&addressBand));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
return addressBand->Refresh(param8); return addressBand->Refresh(param8);
@ -398,9 +415,9 @@ LRESULT CAddressBand::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam,
pt.y = 0; pt.y = 0;
parentWindow = GetParent(); parentWindow = GetParent();
::MapWindowPoints(m_hWnd, parentWindow, &pt, 1); ::MapWindowPoints(m_hWnd, parentWindow, &pt, 1);
OffsetWindowOrgEx((HDC)wParam, pt.x, pt.y, &ptOrig); OffsetWindowOrgEx(reinterpret_cast<HDC>(wParam), pt.x, pt.y, &ptOrig);
result = SendMessage(parentWindow, WM_ERASEBKGND, wParam, 0); result = SendMessage(parentWindow, WM_ERASEBKGND, wParam, 0);
SetWindowOrgEx((HDC)wParam, ptOrig.x, ptOrig.y, NULL); SetWindowOrgEx(reinterpret_cast<HDC>(wParam), ptOrig.x, ptOrig.y, NULL);
if (result == 0) if (result == 0)
{ {
bHandled = FALSE; bHandled = FALSE;
@ -424,20 +441,25 @@ LRESULT CAddressBand::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHan
bHandled = FALSE; bHandled = FALSE;
return 0; return 0;
} }
newHeight = HIWORD(lParam); newHeight = HIWORD(lParam);
newWidth = LOWORD(lParam); newWidth = LOWORD(lParam);
SendMessage(fGoButton, TB_GETITEMRECT, 0, (LPARAM)&buttonBounds);
SendMessage(fGoButton, TB_GETITEMRECT, 0, reinterpret_cast<LPARAM>(&buttonBounds));
buttonWidth = buttonBounds.right - buttonBounds.left; buttonWidth = buttonBounds.right - buttonBounds.left;
buttonHeight = buttonBounds.bottom - buttonBounds.top; buttonHeight = buttonBounds.bottom - buttonBounds.top;
DefWindowProc(WM_SIZE, wParam, MAKELONG(newWidth - buttonWidth - 2, newHeight)); DefWindowProc(WM_SIZE, wParam, MAKELONG(newWidth - buttonWidth - 2, newHeight));
::GetWindowRect(fComboBox, &comboBoxBounds); ::GetWindowRect(fComboBox, &comboBoxBounds);
::SetWindowPos(fGoButton, NULL, newWidth - buttonWidth, (comboBoxBounds.bottom - comboBoxBounds.top - buttonHeight) / 2, ::SetWindowPos(fGoButton, NULL, newWidth - buttonWidth, (comboBoxBounds.bottom - comboBoxBounds.top - buttonHeight) / 2,
buttonWidth, buttonHeight, SWP_NOOWNERZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER); buttonWidth, buttonHeight, SWP_NOOWNERZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);
goButtonBounds.left = newWidth - buttonWidth; goButtonBounds.left = newWidth - buttonWidth;
goButtonBounds.top = 0; goButtonBounds.top = 0;
goButtonBounds.right = newWidth - buttonWidth; goButtonBounds.right = newWidth - buttonWidth;
goButtonBounds.bottom = newHeight; goButtonBounds.bottom = newHeight;
InvalidateRect(&goButtonBounds, TRUE); InvalidateRect(&goButtonBounds, TRUE);
SendMessage(fComboBox, CB_SETDROPPEDWIDTH, 200, 0); SendMessage(fComboBox, CB_SETDROPPEDWIDTH, 200, 0);
return 0; return 0;
} }
@ -453,27 +475,31 @@ LRESULT CAddressBand::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lPara
long newHeight; long newHeight;
long newWidth; long newWidth;
if (fGoButtonShown == false) if (!fGoButtonShown)
{ {
bHandled = FALSE; bHandled = FALSE;
return 0; return 0;
} }
positionInfoCopy = *(WINDOWPOS *)lParam;
positionInfoCopy = *reinterpret_cast<WINDOWPOS *>(lParam);
newHeight = positionInfoCopy.cy; newHeight = positionInfoCopy.cy;
newWidth = positionInfoCopy.cx; newWidth = positionInfoCopy.cx;
SendMessage(fGoButton, TB_GETITEMRECT, 0, (LPARAM)&buttonBounds); SendMessage(fGoButton, TB_GETITEMRECT, 0, reinterpret_cast<LPARAM>(&buttonBounds));
buttonWidth = buttonBounds.right - buttonBounds.left; buttonWidth = buttonBounds.right - buttonBounds.left;
buttonHeight = buttonBounds.bottom - buttonBounds.top; buttonHeight = buttonBounds.bottom - buttonBounds.top;
positionInfoCopy.cx = newWidth - 2 - buttonWidth; positionInfoCopy.cx = newWidth - 2 - buttonWidth;
DefWindowProc(WM_WINDOWPOSCHANGING, wParam, (LPARAM)&positionInfoCopy); DefWindowProc(WM_WINDOWPOSCHANGING, wParam, reinterpret_cast<LPARAM>(&positionInfoCopy));
::GetWindowRect(fComboBox, &comboBoxBounds); ::GetWindowRect(fComboBox, &comboBoxBounds);
::SetWindowPos(fGoButton, NULL, newWidth - buttonWidth, (comboBoxBounds.bottom - comboBoxBounds.top - buttonHeight) / 2, ::SetWindowPos(fGoButton, NULL, newWidth - buttonWidth, (comboBoxBounds.bottom - comboBoxBounds.top - buttonHeight) / 2,
buttonWidth, buttonHeight, SWP_NOOWNERZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER); buttonWidth, buttonHeight, SWP_NOOWNERZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);
goButtonBounds.left = newWidth - buttonWidth; goButtonBounds.left = newWidth - buttonWidth;
goButtonBounds.top = 0; goButtonBounds.top = 0;
goButtonBounds.right = newWidth - buttonWidth; goButtonBounds.right = newWidth - buttonWidth;
goButtonBounds.bottom = newHeight; goButtonBounds.bottom = newHeight;
InvalidateRect(&goButtonBounds, TRUE); InvalidateRect(&goButtonBounds, TRUE);
SendMessage(fComboBox, CB_SETDROPPEDWIDTH, 200, 0); SendMessage(fComboBox, CB_SETDROPPEDWIDTH, 200, 0);
return 0; return 0;
} }
@ -489,8 +515,8 @@ HRESULT CreateAddressBand(REFIID riid, void **ppv)
ATLTRY (theMenuBar = new CComObject<CAddressBand>); ATLTRY (theMenuBar = new CComObject<CAddressBand>);
if (theMenuBar == NULL) if (theMenuBar == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface (riid, (void **)ppv); hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
delete theMenuBar; delete theMenuBar;
return hResult; return hResult;

View file

@ -102,20 +102,20 @@ public:
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
BEGIN_MSG_MAP(CAddressBand) BEGIN_MSG_MAP(CAddressBand)
NOTIFY_CODE_HANDLER(NM_CLICK, OnNotifyClick) NOTIFY_CODE_HANDLER(NM_CLICK, OnNotifyClick)
NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText) NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChanging) MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChanging)
END_MSG_MAP() END_MSG_MAP()
DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSBAND) DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSBAND)
DECLARE_NOT_AGGREGATABLE(CAddressBand) DECLARE_NOT_AGGREGATABLE(CAddressBand)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CAddressBand) BEGIN_COM_MAP(CAddressBand)
COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand) COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
@ -128,5 +128,5 @@ BEGIN_COM_MAP(CAddressBand)
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
END_COM_MAP() END_COM_MAP()
}; };

View file

@ -90,7 +90,8 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Save(long paramC)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CAddressEditBox::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) HRESULT STDMETHODCALLTYPE CAddressEditBox::OnWinEvent(
HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{ {
// handle fill of listbox here // handle fill of listbox here
return E_NOTIMPL; return E_NOTIMPL;
@ -101,12 +102,14 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::IsWindowOwner(HWND hWnd)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CAddressEditBox::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) HRESULT STDMETHODCALLTYPE CAddressEditBox::QueryStatus(
const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CAddressEditBox::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) HRESULT STDMETHODCALLTYPE CAddressEditBox::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -121,12 +124,14 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::GetTypeInfo(UINT iTInfo, LCID lcid, I
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CAddressEditBox::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) HRESULT STDMETHODCALLTYPE CAddressEditBox::GetIDsOfNames(
REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CAddressEditBox::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) HRESULT STDMETHODCALLTYPE CAddressEditBox::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{ {
// on navigate complete, change edit section of combobox // on navigate complete, change edit section of combobox
return E_NOTIMPL; return E_NOTIMPL;
@ -171,8 +176,8 @@ HRESULT CreateAddressEditBox(REFIID riid, void **ppv)
ATLTRY (theMenuBar = new CComObject<CAddressEditBox>); ATLTRY (theMenuBar = new CComObject<CAddressEditBox>);
if (theMenuBar == NULL) if (theMenuBar == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface (riid, (void **)ppv); hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
delete theMenuBar; delete theMenuBar;
return hResult; return hResult;

View file

@ -81,22 +81,22 @@ public:
// LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); // LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
// LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); // LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSEDITBOX) DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSEDITBOX)
DECLARE_NOT_AGGREGATABLE(CAddressEditBox) DECLARE_NOT_AGGREGATABLE(CAddressEditBox)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_MSG_MAP(CAddressEditBox) BEGIN_MSG_MAP(CAddressEditBox)
// MESSAGE_HANDLER(WM_NOTIFY, OnNotify) // MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) // MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
// MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus) // MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
// ALT_MSG_MAP(1) // ALT_MSG_MAP(1)
// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSaveButton) // MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSaveButton)
// ALT_MSG_MAP(2) // ALT_MSG_MAP(2)
// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSelectButton) // MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSelectButton)
END_MSG_MAP() END_MSG_MAP()
BEGIN_COM_MAP(CAddressEditBox) BEGIN_COM_MAP(CAddressEditBox)
COM_INTERFACE_ENTRY_IID(IID_IShellService, IShellService) COM_INTERFACE_ENTRY_IID(IID_IShellService, IShellService)
COM_INTERFACE_ENTRY_IID(IID_IAddressBand, IAddressBand) COM_INTERFACE_ENTRY_IID(IID_IAddressBand, IAddressBand)
COM_INTERFACE_ENTRY_IID(IID_IAddressEditBox, IAddressEditBox) COM_INTERFACE_ENTRY_IID(IID_IAddressEditBox, IAddressEditBox)
@ -105,5 +105,5 @@ BEGIN_COM_MAP(CAddressEditBox)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch) COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
END_COM_MAP() END_COM_MAP()
}; };

View file

@ -42,11 +42,12 @@ HRESULT CBandProxy::FindBrowserWindow(IUnknown **browser)
if (browser == NULL) if (browser == NULL)
return E_POINTER; return E_POINTER;
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = serviceProvider->QueryService(SID_IWebBrowserApp, IID_IWebBrowser2, (void **)&webBrowser); hResult = serviceProvider->QueryService(
if (FAILED (hResult)) SID_IWebBrowserApp, IID_IWebBrowser2, reinterpret_cast<void **>(&webBrowser));
if (FAILED(hResult))
return hResult; return hResult;
*browser = webBrowser.Detach(); *browser = webBrowser.Detach();
return S_OK; return S_OK;
@ -76,7 +77,7 @@ HRESULT STDMETHODCALLTYPE CBandProxy::IsConnected()
HRESULT hResult; HRESULT hResult;
hResult = FindBrowserWindow(&webBrowser); hResult = FindBrowserWindow(&webBrowser);
if (FAILED (hResult) || webBrowser.p == NULL) if (FAILED(hResult) || webBrowser.p == NULL)
return S_FALSE; return S_FALSE;
return S_OK; return S_OK;
} }
@ -94,17 +95,18 @@ HRESULT STDMETHODCALLTYPE CBandProxy::NavigateToPIDL(LPCITEMIDLIST pidl)
HRESULT hResult; HRESULT hResult;
hResult = FindBrowserWindow(&webBrowserUnknown); hResult = FindBrowserWindow(&webBrowserUnknown);
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = webBrowserUnknown->QueryInterface(IID_IWebBrowserApp, (void **)&webBrowser); hResult = webBrowserUnknown->QueryInterface(IID_IWebBrowserApp, reinterpret_cast<void **>(&webBrowser));
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = webBrowser->put_Visible(TRUE); hResult = webBrowser->put_Visible(TRUE);
hResult = webBrowser->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = webBrowser->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (SUCCEEDED (hResult)) if (SUCCEEDED(hResult))
{ {
hResult = serviceProvider->QueryService(SID_STopLevelBrowser, IID_IOleWindow, (void **)&oleWindow); hResult = serviceProvider->QueryService(SID_STopLevelBrowser,
if (SUCCEEDED (hResult)) IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (SUCCEEDED(hResult))
{ {
hResult = oleWindow->GetWindow(&browserWindow); hResult = oleWindow->GetWindow(&browserWindow);
if (IsIconic(browserWindow)) if (IsIconic(browserWindow))
@ -118,7 +120,7 @@ HRESULT STDMETHODCALLTYPE CBandProxy::NavigateToPIDL(LPCITEMIDLIST pidl)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(V_ARRAY(&args)->pvData, pidl, arraySize); memcpy(V_ARRAY(&args)->pvData, pidl, arraySize);
hResult = webBrowser->Navigate2(&args, &emptyVariant, &emptyVariant, &emptyVariant, &emptyVariant); hResult = webBrowser->Navigate2(&args, &emptyVariant, &emptyVariant, &emptyVariant, &emptyVariant);
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
return S_OK; return S_OK;
} }
@ -139,8 +141,8 @@ HRESULT CreateBandProxy(REFIID riid, void **ppv)
ATLTRY (theBandProxy = new CComObject<CBandProxy>); ATLTRY (theBandProxy = new CComObject<CBandProxy>);
if (theBandProxy == NULL) if (theBandProxy == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hResult = theBandProxy->QueryInterface (riid, (void **)ppv); hResult = theBandProxy->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
delete theBandProxy; delete theBandProxy;
return hResult; return hResult;

View file

@ -40,12 +40,12 @@ public:
virtual HRESULT STDMETHODCALLTYPE NavigateToPIDL(LPCITEMIDLIST pidl); virtual HRESULT STDMETHODCALLTYPE NavigateToPIDL(LPCITEMIDLIST pidl);
virtual HRESULT STDMETHODCALLTYPE NavigateToURL(long paramC, long param10); virtual HRESULT STDMETHODCALLTYPE NavigateToURL(long paramC, long param10);
DECLARE_REGISTRY_RESOURCEID(IDR_BANDPROXY) DECLARE_REGISTRY_RESOURCEID(IDR_BANDPROXY)
DECLARE_NOT_AGGREGATABLE(CBandProxy) DECLARE_NOT_AGGREGATABLE(CBandProxy)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CBandProxy) BEGIN_COM_MAP(CBandProxy)
COM_INTERFACE_ENTRY_IID(IID_IBandProxy, IBandProxy) COM_INTERFACE_ENTRY_IID(IID_IBandProxy, IBandProxy)
END_COM_MAP() END_COM_MAP()
}; };

View file

@ -80,7 +80,7 @@ DWORD CBandSiteBase::GetBandSiteViewMode()
VOID CBandSiteBase::BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi) VOID CBandSiteBase::BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi)
{ {
memset(prbi, 0, sizeof(*prbi)); ZeroMemory(prbi, sizeof(*prbi));
prbi->cbSize = sizeof(*prbi); prbi->cbSize = sizeof(*prbi);
prbi->fMask = RBBIM_ID; prbi->fMask = RBBIM_ID;
@ -161,7 +161,7 @@ HRESULT CBandSiteBase::UpdateSingleBand(struct BandObject *Band)
UINT uBand; UINT uBand;
HRESULT hRet; HRESULT hRet;
memset(&Band->dbi, 0, sizeof(Band->dbi)); ZeroMemory(&Band->dbi, sizeof(Band->dbi));
Band->dbi.dwMask = DBIM_MINSIZE | DBIM_MAXSIZE | DBIM_INTEGRAL | Band->dbi.dwMask = DBIM_MINSIZE | DBIM_MAXSIZE | DBIM_INTEGRAL |
DBIM_ACTUAL | DBIM_TITLE | DBIM_MODEFLAGS | DBIM_BKCOLOR; DBIM_ACTUAL | DBIM_TITLE | DBIM_MODEFLAGS | DBIM_BKCOLOR;
@ -181,7 +181,7 @@ HRESULT CBandSiteBase::UpdateSingleBand(struct BandObject *Band)
uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0); uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0);
if (uBand != (UINT)-1) if (uBand != (UINT)-1)
{ {
if (!SendMessageW(fRebarWindow, RB_SETBANDINFOW, (WPARAM)uBand, (LPARAM)&rbi)) if (!SendMessageW(fRebarWindow, RB_SETBANDINFOW, (WPARAM)uBand, reinterpret_cast<LPARAM>(&rbi)))
{ {
WARN("Failed to update the rebar band!\n"); WARN("Failed to update the rebar band!\n");
} }
@ -204,7 +204,7 @@ HRESULT CBandSiteBase::UpdateAllBands()
if (fBands[i].DeskBand != NULL) if (fBands[i].DeskBand != NULL)
{ {
hRet = UpdateSingleBand(&fBands[i]); hRet = UpdateSingleBand(&fBands[i]);
if (!SUCCEEDED(hRet)) if (FAILED(hRet))
return hRet; return hRet;
} }
} }
@ -258,8 +258,7 @@ CBandSiteBase::~CBandSiteBase()
if (fBands != NULL) if (fBands != NULL)
{ {
int i; for (INT i = 0; i < fBandsAllocated; i++)
for (i = 0; i < fBandsAllocated; i++)
{ {
if (fBands[i].DeskBand != NULL) if (fBands[i].DeskBand != NULL)
FreeBand(&fBands[i]); FreeBand(&fBands[i]);
@ -271,7 +270,6 @@ CBandSiteBase::~CBandSiteBase()
HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk) HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
{ {
INT i;
LONG NewAllocated; LONG NewAllocated;
struct BandObject *NewBand = NULL; struct BandObject *NewBand = NULL;
CComPtr<IDeskBand> DeskBand; CComPtr<IDeskBand> DeskBand;
@ -287,16 +285,16 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
if (punk == NULL || fRebarWindow == NULL) if (punk == NULL || fRebarWindow == NULL)
return E_FAIL; return E_FAIL;
hRet = punk->QueryInterface(IID_IDeskBand, (PVOID *)&DeskBand); hRet = punk->QueryInterface(IID_IDeskBand, reinterpret_cast<PVOID *>(&DeskBand));
if (!SUCCEEDED(hRet) || DeskBand == NULL) if (!SUCCEEDED(hRet) || DeskBand == NULL)
goto Cleanup; goto Cleanup;
hRet = punk->QueryInterface(IID_IObjectWithSite, (PVOID *)&ObjWithSite); hRet = punk->QueryInterface(IID_IObjectWithSite, reinterpret_cast<PVOID *>(&ObjWithSite));
if (!SUCCEEDED(hRet) || ObjWithSite == NULL) if (!SUCCEEDED(hRet) || ObjWithSite == NULL)
goto Cleanup; goto Cleanup;
hRet = punk->QueryInterface(IID_IOleWindow, (PVOID *)&OleWindow); hRet = punk->QueryInterface(IID_IOleWindow, reinterpret_cast<PVOID *>(&OleWindow));
if (!SUCCEEDED(hRet) || OleWindow == NULL) if (!SUCCEEDED(hRet) || OleWindow == NULL)
goto Cleanup; goto Cleanup;
hRet = punk->QueryInterface(IID_IWinEventHandler, (PVOID *)&WndEvtHandler); hRet = punk->QueryInterface(IID_IWinEventHandler, reinterpret_cast<PVOID *>(&WndEvtHandler));
if (!SUCCEEDED(hRet) || WndEvtHandler == NULL) if (!SUCCEEDED(hRet) || WndEvtHandler == NULL)
goto Cleanup; goto Cleanup;
@ -304,7 +302,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
if (fBandsAllocated > fBandsCount) if (fBandsAllocated > fBandsCount)
{ {
/* Search for a free band object */ /* Search for a free band object */
for (i = 0; i < fBandsAllocated; i++) for (INT i = 0; i < fBandsAllocated; i++)
{ {
if (fBands[i].DeskBand == NULL) if (fBands[i].DeskBand == NULL)
{ {
@ -377,7 +375,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
NewBand->WndEvtHandler = WndEvtHandler.Detach(); NewBand->WndEvtHandler = WndEvtHandler.Detach();
/* Create the ReBar band */ /* Create the ReBar band */
hRet = ObjWithSite->SetSite((IOleWindow *)this); hRet = ObjWithSite->SetSite(static_cast<IOleWindow *>(this));
if (SUCCEEDED(hRet)) if (SUCCEEDED(hRet))
{ {
uBand = 0xffffffff; uBand = 0xffffffff;
@ -399,7 +397,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild); WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild);
} }
if (!SendMessageW(fRebarWindow, RB_INSERTBANDW, (WPARAM)uBand, (LPARAM)&rbi)) if (!SendMessageW(fRebarWindow, RB_INSERTBANDW, (WPARAM)uBand, reinterpret_cast<LPARAM>(&rbi)))
return E_FAIL; return E_FAIL;
hRet = (HRESULT)((USHORT)GetBandID(NewBand)); hRet = (HRESULT)((USHORT)GetBandID(NewBand));
@ -460,7 +458,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::EnumBands(UINT uBand, DWORD *pdwBandID)
return E_FAIL; return E_FAIL;
} }
HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName) HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryBand(DWORD dwBandID, IDeskBand **ppstb,
DWORD *pdwState, LPWSTR pszName, int cchName)
{ {
struct BandObject *Band; struct BandObject *Band;
@ -624,30 +623,28 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::SetDeskBarSite(IUnknown *pUnk)
{ {
HWND hWndParent; HWND hWndParent;
HRESULT hRet; HRESULT hRet;
DWORD style;
TRACE("(%p, %p)\n", this, pUnk); TRACE("(%p, %p)\n", this, pUnk);
fOleWindow.Release(); fOleWindow.Release();
hRet = pUnk->QueryInterface(IID_IOleWindow, (PVOID *)&fOleWindow); hRet = pUnk->QueryInterface(IID_IOleWindow, (PVOID *)&fOleWindow);
if (!SUCCEEDED(hRet)) if (FAILED(hRet))
return E_FAIL; return E_FAIL;
hRet = fOleWindow->GetWindow(&hWndParent); hRet = fOleWindow->GetWindow(&hWndParent);
if (!SUCCEEDED(hRet)) if (FAILED(hRet))
return E_FAIL; return E_FAIL;
style = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT |
RBS_BANDBORDERS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN;
fRebarWindow = CreateWindowExW(WS_EX_TOOLWINDOW, fRebarWindow = CreateWindowExW(WS_EX_TOOLWINDOW,
REBARCLASSNAMEW, REBARCLASSNAMEW,
NULL, NULL,
WS_CHILD | WS_CLIPSIBLINGS | style,
WS_CLIPCHILDREN | RBS_VARHEIGHT | 0, 0, 0, 0,
RBS_BANDBORDERS | CCS_NODIVIDER |
CCS_NORESIZE | CCS_NOPARENTALIGN,
0,
0,
0,
0,
hWndParent, hWndParent,
NULL, NULL,
_AtlBaseModule.GetModuleInstance(), _AtlBaseModule.GetModuleInstance(),
@ -705,13 +702,15 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSize(DWORD unknown1, LPRECT unknown2
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryStatus(const GUID *pguidCmdGroup, DWORD cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText) HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryStatus(const GUID *pguidCmdGroup,
DWORD cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
{ {
FIXME("(%p, %p, %u, %p, %p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText); FIXME("(%p, %p, %u, %p, %p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBandSiteBase::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut) HRESULT STDMETHODCALLTYPE CBandSiteBase::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
{ {
HRESULT hRet = S_OK; HRESULT hRet = S_OK;
@ -803,7 +802,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSizeMax(ULARGE_INTEGER *pcbSize)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBandSiteBase::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) HRESULT STDMETHODCALLTYPE CBandSiteBase::DragEnter(
IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }

View file

@ -121,7 +121,7 @@ private:
HRESULT UpdateBand(DWORD dwBandID); HRESULT UpdateBand(DWORD dwBandID);
struct BandObject *GetBandFromHwnd(HWND hwnd); struct BandObject *GetBandFromHwnd(HWND hwnd);
BEGIN_COM_MAP(CBandSiteBase) BEGIN_COM_MAP(CBandSiteBase)
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite) COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler) COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
@ -134,7 +134,7 @@ BEGIN_COM_MAP(CBandSiteBase)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper) COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper)
END_COM_MAP() END_COM_MAP()
}; };
class CBandSite : class CBandSite :
@ -143,9 +143,8 @@ class CBandSite :
{ {
public: public:
DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITE) DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITE)
DECLARE_NOT_AGGREGATABLE(CBandSite) DECLARE_NOT_AGGREGATABLE(CBandSite)
DECLARE_PROTECT_FINAL_CONSTRUCT()
DECLARE_PROTECT_FINAL_CONSTRUCT()
}; };

View file

@ -37,7 +37,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteMenu::SetOwner(IUnknown *pOwner)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBandSiteMenu::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) HRESULT STDMETHODCALLTYPE CBandSiteMenu::QueryContextMenu(
HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{ {
FIXME("(%p, %p, %p, %p, %p, %p)\n", this, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags); FIXME("(%p, %p, %p, %p, %p, %p)\n", this, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
return E_NOTIMPL; return E_NOTIMPL;
@ -49,7 +50,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpi
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBandSiteMenu::GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) HRESULT STDMETHODCALLTYPE CBandSiteMenu::GetCommandString(UINT_PTR idCmd, UINT uType,
UINT *pwReserved, LPSTR pszName, UINT cchMax)
{ {
FIXME("(%p, %p, %p, %p, %p, %p)\n", this, idCmd, uType, pwReserved, pszName, cchMax); FIXME("(%p, %p, %p, %p, %p, %p)\n", this, idCmd, uType, pwReserved, pszName, cchMax);
return E_NOTIMPL; return E_NOTIMPL;

View file

@ -43,15 +43,14 @@ public:
// *** IContextMenu2 methods *** // *** IContextMenu2 methods ***
virtual HRESULT STDMETHODCALLTYPE HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam); virtual HRESULT STDMETHODCALLTYPE HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITEMENU) DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITEMENU)
DECLARE_NOT_AGGREGATABLE(CBandSiteMenu) DECLARE_NOT_AGGREGATABLE(CBandSiteMenu)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CBandSiteMenu) BEGIN_COM_MAP(CBandSiteMenu)
COM_INTERFACE_ENTRY_IID(IID_IShellService, IShellService) COM_INTERFACE_ENTRY_IID(IID_IShellService, IShellService)
COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2) COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
END_COM_MAP() END_COM_MAP()
}; };

View file

@ -72,11 +72,13 @@ public:
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
// *** IInputObjectSite specific methods *** // *** IInputObjectSite specific methods ***
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus); virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
// *** IOleCommandTarget specific methods *** // *** IOleCommandTarget specific methods ***
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
// *** IServiceProvider methods *** // *** IServiceProvider methods ***
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
@ -176,10 +178,10 @@ HRESULT CBaseBar::ReserveBorderSpace()
RECT neededBorderSpace; RECT neededBorderSpace;
HRESULT hResult; HRESULT hResult;
hResult = fSite->QueryInterface(IID_IDockingWindowSite, (void **)&dockingWindowSite); hResult = fSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&dockingWindowSite));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = dockingWindowSite->GetBorderDW((IDeskBar *)this, &availableBorderSpace); hResult = dockingWindowSite->GetBorderDW(static_cast<IDeskBar *>(this), &availableBorderSpace);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
memset(&neededBorderSpace, 0, sizeof(neededBorderSpace)); memset(&neededBorderSpace, 0, sizeof(neededBorderSpace));
@ -190,7 +192,7 @@ HRESULT CBaseBar::ReserveBorderSpace()
else else
neededBorderSpace.bottom = fNeededSize + GetSystemMetrics(SM_CXFRAME); neededBorderSpace.bottom = fNeededSize + GetSystemMetrics(SM_CXFRAME);
} }
hResult = dockingWindowSite->SetBorderSpaceDW((IDeskBar *)this, &neededBorderSpace); hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDeskBar *>(this), &neededBorderSpace);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
return S_OK; return S_OK;
@ -234,12 +236,14 @@ HRESULT STDMETHODCALLTYPE CBaseBar::OnFocusChangeIS (IUnknown *punkObj, BOOL fSe
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBaseBar::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) HRESULT STDMETHODCALLTYPE CBaseBar::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBaseBar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) HRESULT STDMETHODCALLTYPE CBaseBar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{ {
if (IsEqualIID(*pguidCmdGroup, CGID_Explorer)) if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
{ {
@ -267,7 +271,7 @@ HRESULT STDMETHODCALLTYPE CBaseBar::QueryService(REFGUID guidService, REFIID rii
if (fSite == NULL) if (fSite == NULL)
return E_FAIL; return E_FAIL;
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
// called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser // called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser
@ -304,16 +308,17 @@ HRESULT STDMETHODCALLTYPE CBaseBar::SetClient(IUnknown *punkClient)
fClient.Release(); fClient.Release();
else else
{ {
hResult = punkClient->QueryInterface(IID_IUnknown, (void **)&fClient); hResult = punkClient->QueryInterface(IID_IUnknown, reinterpret_cast<void **>(&fClient));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = fSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow); hResult = fSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = oleWindow->GetWindow(&ownerWindow); hResult = oleWindow->GetWindow(&ownerWindow);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
Create(ownerWindow, 0, NULL, WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_TOOLWINDOW); Create(ownerWindow, 0, NULL,
WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_TOOLWINDOW);
ReserveBorderSpace(); ReserveBorderSpace();
} }
return S_OK; return S_OK;
@ -465,7 +470,7 @@ LRESULT CBaseBar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
result = 0; result = 0;
if (fClient.p != NULL) if (fClient.p != NULL)
{ {
hResult = fClient->QueryInterface(IID_IWinEventHandler, (void **)&winEventHandler); hResult = fClient->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
if (SUCCEEDED(hResult) && winEventHandler.p != NULL) if (SUCCEEDED(hResult) && winEventHandler.p != NULL)
hResult = winEventHandler->OnWinEvent(NULL, uMsg, wParam, lParam, &result); hResult = winEventHandler->OnWinEvent(NULL, uMsg, wParam, lParam, &result);
} }
@ -532,8 +537,8 @@ HRESULT CreateBaseBar(REFIID riid, void **ppv)
ATLTRY (theBaseBar = new CComObject<CBaseBar>); ATLTRY (theBaseBar = new CComObject<CBaseBar>);
if (theBaseBar == NULL) if (theBaseBar == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hResult = theBaseBar->QueryInterface (riid, (void **)ppv); hResult = theBaseBar->QueryInterface (riid, reinterpret_cast<void **>(ppv));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
delete theBaseBar; delete theBaseBar;
return hResult; return hResult;

View file

@ -83,11 +83,12 @@ private:
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
// *** IWinEventHandler methods *** // *** IWinEventHandler methods ***
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult); virtual HRESULT STDMETHODCALLTYPE OnWinEvent(
HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd); virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
// *** IInputObjectSite specific methods *** // *** IInputObjectSite specific methods ***
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus); virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
// *** IDeskBarClient methods *** // *** IDeskBarClient methods ***
virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite); virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite);
@ -96,13 +97,16 @@ private:
virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc); virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc);
// *** IOleCommandTarget methods *** // *** IOleCommandTarget methods ***
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
// *** IBandSite specific methods *** // *** IBandSite specific methods ***
virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk); virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk);
virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID); virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID);
virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName); virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState,
LPWSTR pszName, int cchName);
virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState); virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState);
virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID); virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID);
virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, void **ppv); virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, void **ppv);
@ -165,37 +169,44 @@ HRESULT CBaseBarSite::InsertBar(IUnknown *newBar)
DWORD thisBandID; DWORD thisBandID;
HRESULT hResult; HRESULT hResult;
hResult = newBar->QueryInterface(IID_IPersist, (void **)&persist); hResult = newBar->QueryInterface(IID_IPersist, reinterpret_cast<void **>(&persist));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = newBar->QueryInterface(IID_IObjectWithSite, (void **)&site); hResult = newBar->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&site));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = newBar->QueryInterface(IID_IOleWindow, (void **)&oleWindow); hResult = newBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = newBar->QueryInterface(IID_IDeskBand, (void **)&deskBand); hResult = newBar->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(&deskBand));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = newBar->QueryInterface(IID_IDockingWindow, (void **)&dockingWindow); hResult = newBar->QueryInterface(IID_IDockingWindow, reinterpret_cast<void **>(&dockingWindow));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = site->SetSite((IOleWindow *)this); hResult = site->SetSite(static_cast<IOleWindow *>(this));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
newInfo = new CBarInfo; ATLTRY(newInfo = new CBarInfo);
if (newInfo == NULL) if (newInfo == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
// set new bar info
thisBandID = fNextBandID++; thisBandID = fNextBandID++;
newInfo->fTheBar = newBar; newInfo->fTheBar = newBar;
newInfo->fBandID = thisBandID; newInfo->fBandID = thisBandID;
hResult = persist->GetClassID(&newInfo->fBarClass); hResult = persist->GetClassID(&newInfo->fBarClass);
// get band info
deskBandInfo.dwMask = DBIM_MINSIZE | DBIM_ACTUAL | DBIM_TITLE; deskBandInfo.dwMask = DBIM_MINSIZE | DBIM_ACTUAL | DBIM_TITLE;
deskBandInfo.wszTitle[0] = 0; deskBandInfo.wszTitle[0] = 0;
hResult = deskBand->GetBandInfo(0, 0, &deskBandInfo); hResult = deskBand->GetBandInfo(0, 0, &deskBandInfo);
// insert band
memset(&bandInfo, 0, sizeof(bandInfo)); memset(&bandInfo, 0, sizeof(bandInfo));
bandInfo.cbSize = sizeof(bandInfo); bandInfo.cbSize = sizeof(bandInfo);
bandInfo.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_TEXT | RBBIM_LPARAM | RBBIM_ID; bandInfo.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_TEXT |
RBBIM_LPARAM | RBBIM_ID;
bandInfo.fStyle = RBBS_NOGRIPPER | RBBS_VARIABLEHEIGHT; bandInfo.fStyle = RBBS_NOGRIPPER | RBBS_VARIABLEHEIGHT;
bandInfo.lpText = deskBandInfo.wszTitle; bandInfo.lpText = deskBandInfo.wszTitle;
hResult = oleWindow->GetWindow(&bandInfo.hwndChild); hResult = oleWindow->GetWindow(&bandInfo.hwndChild);
@ -207,9 +218,11 @@ HRESULT CBaseBarSite::InsertBar(IUnknown *newBar)
bandInfo.cyMaxChild = 32000; bandInfo.cyMaxChild = 32000;
bandInfo.cyIntegral = 1; bandInfo.cyIntegral = 1;
bandInfo.cxIdeal = 0; //deskBandInfo.ptActual.x; bandInfo.cxIdeal = 0; //deskBandInfo.ptActual.x;
bandInfo.lParam = (LPARAM)newInfo; bandInfo.lParam = reinterpret_cast<LPARAM>(newInfo);
SendMessage(RB_INSERTBANDW, -1, (LPARAM)&bandInfo); SendMessage(RB_INSERTBANDW, -1, reinterpret_cast<LPARAM>(&bandInfo));
hResult = dockingWindow->ShowDW(TRUE); // this call is what makes the tree fill with contents
// this call is what makes the tree fill with contents
hResult = dockingWindow->ShowDW(TRUE);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
// for now // for now
@ -252,7 +265,7 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryService(REFGUID guidService, REFIID
if (fDeskBarSite == NULL) if (fDeskBarSite == NULL)
return E_FAIL; return E_FAIL;
hResult = fDeskBarSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fDeskBarSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
// called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser // called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser
@ -261,7 +274,8 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryService(REFGUID guidService, REFIID
return serviceProvider->QueryService(guidService, riid, ppvObject); return serviceProvider->QueryService(guidService, riid, ppvObject);
} }
HRESULT STDMETHODCALLTYPE CBaseBarSite::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) HRESULT STDMETHODCALLTYPE CBaseBarSite::OnWinEvent(
HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{ {
CComPtr<IDeskBar> deskBar; CComPtr<IDeskBar> deskBar;
CComPtr<IWinEventHandler> winEventHandler; CComPtr<IWinEventHandler> winEventHandler;
@ -275,14 +289,15 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
notifyHeader = (NMHDR *)lParam; notifyHeader = (NMHDR *)lParam;
if (notifyHeader->hwndFrom == m_hWnd && notifyHeader->code == RBN_AUTOSIZE) if (notifyHeader->hwndFrom == m_hWnd && notifyHeader->code == RBN_AUTOSIZE)
{ {
hResult = fDeskBarSite->QueryInterface(IID_IDeskBar, (void **)&deskBar); hResult = fDeskBarSite->QueryInterface(IID_IDeskBar, reinterpret_cast<void **>(&deskBar));
GetClientRect(&newBounds); GetClientRect(&newBounds);
hResult = deskBar->OnPosRectChangeDB(&newBounds); hResult = deskBar->OnPosRectChangeDB(&newBounds);
} }
} }
if (fCurrentActiveBar != NULL) if (fCurrentActiveBar != NULL)
{ {
hResult = fCurrentActiveBar->fTheBar->QueryInterface(IID_IWinEventHandler, (void **)&winEventHandler); hResult = fCurrentActiveBar->fTheBar->QueryInterface(
IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
if (SUCCEEDED(hResult) && winEventHandler.p != NULL) if (SUCCEEDED(hResult) && winEventHandler.p != NULL)
hResult = winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult); hResult = winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
} }
@ -309,16 +324,16 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::SetDeskBarSite(IUnknown *punkSite)
fDeskBarSite.Release(); fDeskBarSite.Release();
else else
{ {
hResult = punkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow); hResult = punkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = punkSite->QueryInterface(IID_IUnknown, (void **)&fDeskBarSite); hResult = punkSite->QueryInterface(IID_IUnknown, reinterpret_cast<void **>(&fDeskBarSite));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = oleWindow->GetWindow(&ownerWindow); hResult = oleWindow->GetWindow(&ownerWindow);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
m_hWnd = CreateWindow(REBARCLASSNAMEW, _T(""), WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | m_hWnd = CreateWindow(REBARCLASSNAMEW, NULL, WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | WS_CLIPCHILDREN |
RBS_VARHEIGHT | RBS_REGISTERDROP | RBS_AUTOSIZE | RBS_VERTICALGRIPPER | RBS_DBLCLKTOGGLE | RBS_VARHEIGHT | RBS_REGISTERDROP | RBS_AUTOSIZE | RBS_VERTICALGRIPPER | RBS_DBLCLKTOGGLE |
CCS_LEFT | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE, 0, 0, 0, 0, ownerWindow, NULL, CCS_LEFT | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE, 0, 0, 0, 0, ownerWindow, NULL,
@ -344,12 +359,14 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::GetSize(DWORD dwWhich, LPRECT prc)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryStatus(const GUID *pguidCmdGroup,
ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBaseBarSite::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) HRESULT STDMETHODCALLTYPE CBaseBarSite::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{ {
if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand)) if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand))
{ {
@ -379,7 +396,8 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::EnumBands(UINT uBand, DWORD *pdwBandID)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName) HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryBand(DWORD dwBandID, IDeskBand **ppstb,
DWORD *pdwState, LPWSTR pszName, int cchName)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -449,7 +467,7 @@ LRESULT CBaseBarSite::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bH
{ {
NMHDR *notifyHeader; NMHDR *notifyHeader;
notifyHeader = (NMHDR *)lParam; notifyHeader = reinterpret_cast<NMHDR *>(lParam);
if (notifyHeader->hwndFrom == m_hWnd) if (notifyHeader->hwndFrom == m_hWnd)
{ {
} }
@ -467,8 +485,8 @@ HRESULT CreateBaseBarSite(REFIID riid, void **ppv)
ATLTRY (theBaseBarSite = new CComObject<CBaseBarSite>); ATLTRY (theBaseBarSite = new CComObject<CBaseBarSite>);
if (theBaseBarSite == NULL) if (theBaseBarSite == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hResult = theBaseBarSite->QueryInterface (riid, (void **)ppv); hResult = theBaseBarSite->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
delete theBaseBarSite; delete theBaseBarSite;
return hResult; return hResult;

View file

@ -167,30 +167,40 @@ HRESULT STDMETHODCALLTYPE CBrandBand::SetSite(IUnknown* pUnkSite)
// TODO: revoke brand band service // TODO: revoke brand band service
return S_OK; return S_OK;
} }
hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, (void **)&fSite);
// get window handle of parent
hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&fSite));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
parentWindow = NULL; parentWindow = NULL;
hResult = pUnkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow); hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (SUCCEEDED(hResult)) if (SUCCEEDED(hResult))
hResult = oleWindow->GetWindow(&parentWindow); hResult = oleWindow->GetWindow(&parentWindow);
if (!::IsWindow(parentWindow)) if (!::IsWindow(parentWindow))
return E_FAIL; return E_FAIL;
hwnd = SHCreateWorkerWindowW(0, parentWindow, 0, WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, NULL, 0); // create worker window in parent window
hwnd = SHCreateWorkerWindowW(0, parentWindow, 0,
WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, NULL, 0);
if (hwnd == NULL) if (hwnd == NULL)
return E_FAIL; return E_FAIL;
SubclassWindow(hwnd); SubclassWindow(hwnd);
hResult = pUnkSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
// take advice to watch events
hResult = pUnkSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (SUCCEEDED(hResult)) if (SUCCEEDED(hResult))
{ {
hResult = serviceProvider->QueryService(SID_SBrandBand, IID_IProfferService, (void **)&profferService); hResult = serviceProvider->QueryService(
SID_SBrandBand, IID_IProfferService, reinterpret_cast<void **>(&profferService));
if (SUCCEEDED(hResult)) if (SUCCEEDED(hResult))
hResult = profferService->ProfferService(SID_SBrandBand, (IServiceProvider *)this, &fProfferCookie); hResult = profferService->ProfferService(SID_SBrandBand,
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService, (void **)&browserService); static_cast<IServiceProvider *>(this), &fProfferCookie);
hResult = serviceProvider->QueryService(SID_SShellBrowser,
IID_IBrowserService, reinterpret_cast<void **>(&browserService));
if (SUCCEEDED(hResult)) if (SUCCEEDED(hResult))
hResult = AtlAdvise(browserService, (IDispatch *)this, DIID_DWebBrowserEvents, &fAdviseCookie); hResult = AtlAdvise(browserService, static_cast<IDispatch *>(this), DIID_DWebBrowserEvents, &fAdviseCookie);
} }
// ignore any hResult errors up to here - they are nonfatal // ignore any hResult errors up to here - they are nonfatal
hResult = S_OK; hResult = S_OK;
SelectImage(); SelectImage();
@ -234,7 +244,8 @@ HRESULT STDMETHODCALLTYPE CBrandBand::CloseDW(DWORD dwReserved)
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CBrandBand::ResizeBorderDW(const RECT* prcBorder, IUnknown* punkToolbarSite, BOOL fReserved) HRESULT STDMETHODCALLTYPE CBrandBand::ResizeBorderDW(
const RECT* prcBorder, IUnknown* punkToolbarSite, BOOL fReserved)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -296,7 +307,8 @@ HRESULT STDMETHODCALLTYPE CBrandBand::GetSizeMax(ULARGE_INTEGER *pcbSize)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBrandBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) HRESULT STDMETHODCALLTYPE CBrandBand::OnWinEvent(
HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -308,12 +320,14 @@ HRESULT STDMETHODCALLTYPE CBrandBand::IsWindowOwner(HWND hWnd)
return S_FALSE; return S_FALSE;
} }
HRESULT STDMETHODCALLTYPE CBrandBand::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) HRESULT STDMETHODCALLTYPE CBrandBand::QueryStatus(
const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBrandBand::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) HRESULT STDMETHODCALLTYPE CBrandBand::Exec(const GUID *pguidCmdGroup,
DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{ {
if (IsEqualIID(*pguidCmdGroup, CGID_PrivCITCommands)) if (IsEqualIID(*pguidCmdGroup, CGID_PrivCITCommands))
{ {
@ -340,8 +354,8 @@ HRESULT STDMETHODCALLTYPE CBrandBand::QueryService(REFGUID guidService, REFIID r
if (IsEqualIID(guidService, SID_SBrandBand)) if (IsEqualIID(guidService, SID_SBrandBand))
return this->QueryInterface(riid, ppvObject); return this->QueryInterface(riid, ppvObject);
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
return serviceProvider->QueryService(guidService, riid, ppvObject); return serviceProvider->QueryService(guidService, riid, ppvObject);
} }
@ -356,12 +370,14 @@ HRESULT STDMETHODCALLTYPE CBrandBand::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeI
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBrandBand::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) HRESULT STDMETHODCALLTYPE CBrandBand::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CBrandBand::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) HRESULT STDMETHODCALLTYPE CBrandBand::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{ {
if (pDispParams == NULL) if (pDispParams == NULL)
return E_INVALIDARG; return E_INVALIDARG;
@ -431,7 +447,7 @@ LRESULT CBrandBand::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHand
FillSolidRect(dc, &paintInfo.rcPaint, RGB(255, 255, 255)); FillSolidRect(dc, &paintInfo.rcPaint, RGB(255, 255, 255));
sourceDC = CreateCompatibleDC(dc); sourceDC = CreateCompatibleDC(dc);
oldBitmap = (HBITMAP)SelectObject(sourceDC, fImageBitmap); oldBitmap = reinterpret_cast<HBITMAP>(SelectObject(sourceDC, fImageBitmap));
BitBlt(dc, destinationPoint.x, destinationPoint.y, fBitmapSize, fBitmapSize, sourceDC, 0, fCurrentFrame * fBitmapSize, SRCCOPY); BitBlt(dc, destinationPoint.x, destinationPoint.y, fBitmapSize, fBitmapSize, sourceDC, 0, fCurrentFrame * fBitmapSize, SRCCOPY);
@ -462,8 +478,8 @@ HRESULT CreateBrandBand(REFIID riid, void **ppv)
ATLTRY (theMenuBar = new CComObject<CBrandBand>); ATLTRY (theMenuBar = new CComObject<CBrandBand>);
if (theMenuBar == NULL) if (theMenuBar == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface (riid, (void **)ppv); hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
delete theMenuBar; delete theMenuBar;
return hResult; return hResult;

View file

@ -101,19 +101,19 @@ public:
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
BEGIN_MSG_MAP(CBrandBand) BEGIN_MSG_MAP(CBrandBand)
// MESSAGE_HANDLER(WM_SIZE, OnSize) // MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_TIMER, OnTimer) MESSAGE_HANDLER(WM_TIMER, OnTimer)
END_MSG_MAP() END_MSG_MAP()
DECLARE_REGISTRY_RESOURCEID(IDR_BRANDBAND) DECLARE_REGISTRY_RESOURCEID(IDR_BRANDBAND)
DECLARE_NOT_AGGREGATABLE(CBrandBand) DECLARE_NOT_AGGREGATABLE(CBrandBand)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CBrandBand) BEGIN_COM_MAP(CBrandBand)
COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand) COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
@ -125,5 +125,5 @@ BEGIN_COM_MAP(CBrandBand)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch) COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
END_COM_MAP() END_COM_MAP()
}; };

View file

@ -97,7 +97,8 @@ extern "C" long WINAPI IDataObject_GetDeskBandState(long param8)
/************************************************************************* /*************************************************************************
* SHCreateIETHREADPARAM [BROWSEUI.123] * SHCreateIETHREADPARAM [BROWSEUI.123]
*/ */
extern "C" IEThreadParamBlock *WINAPI SHCreateIETHREADPARAM(long param8, long paramC, IUnknown *param10, IUnknown *param14) extern "C" IEThreadParamBlock *WINAPI SHCreateIETHREADPARAM(
long param8, long paramC, IUnknown *param10, IUnknown *param14)
{ {
IEThreadParamBlock *result; IEThreadParamBlock *result;
@ -250,7 +251,8 @@ extern "C" HRESULT WINAPI SHEnumClassesOfCategories(long param8, long paramC, lo
/************************************************************************* /*************************************************************************
* SHWriteClassesOfCategories [BROWSEUI.137] * SHWriteClassesOfCategories [BROWSEUI.137]
*/ */
extern "C" HRESULT WINAPI SHWriteClassesOfCategories(long param8, long paramC, long param10, long param14, long param18, long param1C, long param20) extern "C" HRESULT WINAPI SHWriteClassesOfCategories(long param8, long paramC, long param10,
long param14, long param18, long param1C, long param20)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }

View file

@ -33,12 +33,14 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::QueryService(REFGUID guidService, REFI
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CCommonBrowser::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) HRESULT STDMETHODCALLTYPE CCommonBrowser::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CCommonBrowser::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) HRESULT STDMETHODCALLTYPE CCommonBrowser::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -253,7 +255,8 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::ActivatePendingView()
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CCommonBrowser::CreateViewWindow(IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd) HRESULT STDMETHODCALLTYPE CCommonBrowser::CreateViewWindow(
IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -363,12 +366,14 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::_SwitchActivationNow()
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CCommonBrowser::_ExecChildren(IUnknown *punkBar, BOOL fBroadcast, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut) HRESULT STDMETHODCALLTYPE CCommonBrowser::_ExecChildren(IUnknown *punkBar, BOOL fBroadcast,
const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CCommonBrowser::_SendChildren(HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam) HRESULT STDMETHODCALLTYPE CCommonBrowser::_SendChildren(
HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -468,7 +473,8 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::_CloseAndReleaseToolbars(BOOL fClose)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CCommonBrowser::v_MayGetNextToolbarFocus(LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd) HRESULT STDMETHODCALLTYPE CCommonBrowser::v_MayGetNextToolbarFocus(LPMSG lpMsg, UINT itbNext,
int citb, LPTOOLBARITEM *pptbi, HWND *phwnd)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -508,7 +514,8 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::_PositionViewWindow(HWND *, RECT *)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CCommonBrowser::IEParseDisplayNameEx(unsigned int, const unsigned short *, DWORD, LPITEMIDLIST *) HRESULT STDMETHODCALLTYPE CCommonBrowser::IEParseDisplayNameEx(
unsigned int, const unsigned short *, DWORD, LPITEMIDLIST *)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }

View file

@ -186,11 +186,11 @@ public:
virtual HRESULT STDMETHODCALLTYPE DragLeave(); virtual HRESULT STDMETHODCALLTYPE DragLeave();
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
DECLARE_REGISTRY_RESOURCEID(IDR_COMMONBROWSER) DECLARE_REGISTRY_RESOURCEID(IDR_COMMONBROWSER)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CCommonBrowser) BEGIN_COM_MAP(CCommonBrowser)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService) COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService)
@ -203,5 +203,5 @@ BEGIN_COM_MAP(CCommonBrowser)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindowFrame, IDockingWindowFrame) COM_INTERFACE_ENTRY_IID(IID_IDockingWindowFrame, IDockingWindowFrame)
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
END_COM_MAP() END_COM_MAP()
}; };

View file

@ -33,7 +33,8 @@ HRESULT STDMETHODCALLTYPE CGlobalFolderSettings::Get(DEFFOLDERSETTINGS *paramC,
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CGlobalFolderSettings::Set(const DEFFOLDERSETTINGS *paramC, int param10, unsigned int param14) HRESULT STDMETHODCALLTYPE CGlobalFolderSettings::Set(
const DEFFOLDERSETTINGS *paramC, int param10, unsigned int param14)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }

View file

@ -34,12 +34,12 @@ public:
virtual HRESULT STDMETHODCALLTYPE Get(DEFFOLDERSETTINGS *paramC, int param10); virtual HRESULT STDMETHODCALLTYPE Get(DEFFOLDERSETTINGS *paramC, int param10);
virtual HRESULT STDMETHODCALLTYPE Set(const DEFFOLDERSETTINGS *paramC, int param10, unsigned int param14); virtual HRESULT STDMETHODCALLTYPE Set(const DEFFOLDERSETTINGS *paramC, int param10, unsigned int param14);
DECLARE_REGISTRY_RESOURCEID(IDR_GLOBALFOLDERSETTINGS) DECLARE_REGISTRY_RESOURCEID(IDR_GLOBALFOLDERSETTINGS)
DECLARE_NOT_AGGREGATABLE(CGlobalFolderSettings) DECLARE_NOT_AGGREGATABLE(CGlobalFolderSettings)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CGlobalFolderSettings) BEGIN_COM_MAP(CGlobalFolderSettings)
COM_INTERFACE_ENTRY_IID(IID_IGlobalFolderSettings, IGlobalFolderSettings) COM_INTERFACE_ENTRY_IID(IID_IGlobalFolderSettings, IGlobalFolderSettings)
END_COM_MAP() END_COM_MAP()
}; };

View file

@ -115,8 +115,10 @@ private:
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus); virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
// *** IOleCommandTarget specific methods *** // *** IOleCommandTarget specific methods ***
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
// *** IServiceProvider methods *** // *** IServiceProvider methods ***
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
@ -154,13 +156,13 @@ HRESULT CDockSite::Initialize(IUnknown *containedBand, CInternetToolbar *browser
REBARBANDINFOW bandInfo; REBARBANDINFOW bandInfo;
HRESULT hResult; HRESULT hResult;
hResult = containedBand->QueryInterface(IID_IObjectWithSite, (void **)&site); hResult = containedBand->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&site));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = containedBand->QueryInterface(IID_IOleWindow, (void **)&oleWindow); hResult = containedBand->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = containedBand->QueryInterface(IID_IDeskBand, (void **)&deskBand); hResult = containedBand->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(&deskBand));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
fContainedBand = containedBand; fContainedBand = containedBand;
@ -168,7 +170,7 @@ HRESULT CDockSite::Initialize(IUnknown *containedBand, CInternetToolbar *browser
fRebarWindow = hwnd; fRebarWindow = hwnd;
fBandID = bandID; fBandID = bandID;
fFlags = flags; fFlags = flags;
hResult = site->SetSite((IOleWindow *)this); hResult = site->SetSite(static_cast<IOleWindow *>(this));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = oleWindow->GetWindow(&fChildWindow); hResult = oleWindow->GetWindow(&fChildWindow);
@ -192,15 +194,17 @@ HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
CComPtr<IDeskBand> deskBand; CComPtr<IDeskBand> deskBand;
HRESULT hResult; HRESULT hResult;
hResult = fContainedBand->QueryInterface(IID_IDeskBand, (void **)&deskBand); hResult = fContainedBand->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(&deskBand));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
fDeskBandInfo.dwMask = DBIM_BKCOLOR | DBIM_MODEFLAGS | DBIM_TITLE | DBIM_ACTUAL | DBIM_INTEGRAL | DBIM_MAXSIZE | DBIM_MINSIZE; fDeskBandInfo.dwMask = DBIM_BKCOLOR | DBIM_MODEFLAGS | DBIM_TITLE | DBIM_ACTUAL |
DBIM_INTEGRAL | DBIM_MAXSIZE | DBIM_MINSIZE;
hResult = deskBand->GetBandInfo(fBandID, 0, &fDeskBandInfo); hResult = deskBand->GetBandInfo(fBandID, 0, &fDeskBandInfo);
// result of call is ignored // result of call is ignored
bandInfo.fMask = RBBIM_LPARAM | RBBIM_IDEALSIZE | RBBIM_ID | RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_TEXT | RBBIM_STYLE; bandInfo.fMask = RBBIM_LPARAM | RBBIM_IDEALSIZE | RBBIM_ID | RBBIM_CHILDSIZE | RBBIM_CHILD |
RBBIM_TEXT | RBBIM_STYLE;
bandInfo.fStyle = RBBS_FIXEDBMP; bandInfo.fStyle = RBBS_FIXEDBMP;
if (fDeskBandInfo.dwModeFlags & DBIMF_VARIABLEHEIGHT) if (fDeskBandInfo.dwModeFlags & DBIMF_VARIABLEHEIGHT)
@ -211,11 +215,11 @@ HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
bandInfo.fStyle |= RBBS_BREAK; bandInfo.fStyle |= RBBS_BREAK;
if (fDeskBandInfo.dwModeFlags & DBIMF_TOPALIGN) if (fDeskBandInfo.dwModeFlags & DBIMF_TOPALIGN)
bandInfo.fStyle |= RBBS_TOPALIGN; bandInfo.fStyle |= RBBS_TOPALIGN;
if (fFlags & ITF_NOGRIPPER || fToolbar->fLocked == true) if (fFlags & ITF_NOGRIPPER || fToolbar->fLocked)
bandInfo.fStyle |= RBBS_NOGRIPPER; bandInfo.fStyle |= RBBS_NOGRIPPER;
if (fFlags & ITF_NOTITLE) if (fFlags & ITF_NOTITLE)
bandInfo.fStyle |= RBBS_HIDETITLE; bandInfo.fStyle |= RBBS_HIDETITLE;
if (fFlags & ITF_GRIPPERALWAYS && fToolbar->fLocked == false) if (fFlags & ITF_GRIPPERALWAYS && !fToolbar->fLocked)
bandInfo.fStyle |= RBBS_GRIPPERALWAYS; bandInfo.fStyle |= RBBS_GRIPPERALWAYS;
if (fFlags & ITF_FIXEDSIZE) if (fFlags & ITF_FIXEDSIZE)
bandInfo.fStyle |= RBBS_FIXEDSIZE; bandInfo.fStyle |= RBBS_FIXEDSIZE;
@ -235,7 +239,7 @@ HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
bandInfo.cyMaxChild = fDeskBandInfo.ptMaxSize.y; bandInfo.cyMaxChild = fDeskBandInfo.ptMaxSize.y;
bandInfo.cyIntegral = fDeskBandInfo.ptIntegral.y; bandInfo.cyIntegral = fDeskBandInfo.ptIntegral.y;
bandInfo.cxIdeal = fDeskBandInfo.ptActual.x; bandInfo.cxIdeal = fDeskBandInfo.ptActual.x;
bandInfo.lParam = (LPARAM)this; bandInfo.lParam = reinterpret_cast<LPARAM>(this);
return S_OK; return S_OK;
} }
@ -272,12 +276,14 @@ HRESULT STDMETHODCALLTYPE CDockSite::OnFocusChangeIS (IUnknown *punkObj, BOOL fS
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CDockSite::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) HRESULT STDMETHODCALLTYPE CDockSite::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CDockSite::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) HRESULT STDMETHODCALLTYPE CDockSite::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt,
VARIANT *pvaIn, VARIANT *pvaOut)
{ {
TCHAR textBuffer[40]; TCHAR textBuffer[40];
REBARBANDINFOW bandInfo; REBARBANDINFOW bandInfo;
@ -319,8 +325,8 @@ HRESULT STDMETHODCALLTYPE CDockSite::QueryService(REFGUID guidService, REFIID ri
if (IsEqualIID(guidService, SID_SMenuBandParent)) if (IsEqualIID(guidService, SID_SMenuBandParent))
return this->QueryInterface(riid, ppvObject); return this->QueryInterface(riid, ppvObject);
hResult = fToolbar->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fToolbar->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
return serviceProvider->QueryService(guidService, riid, ppvObject); return serviceProvider->QueryService(guidService, riid, ppvObject);
} }
@ -345,14 +351,18 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
HKEY orderRegKey; HKEY orderRegKey;
DWORD disposition; DWORD disposition;
HRESULT hResult; HRESULT hResult;
static const TCHAR szFavoritesKey[] =
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Favorites");
if (!IsEqualIID(riid, IID_IShellMenu)) if (!IsEqualIID(riid, IID_IShellMenu))
return E_FAIL; return E_FAIL;
if (psmd->uId != FCIDM_MENU_FAVORITES) if (psmd->uId != FCIDM_MENU_FAVORITES)
return E_FAIL; return E_FAIL;
if (fFavoritesMenu.p == NULL) if (fFavoritesMenu.p == NULL)
{ {
hResult = psmd->punk->QueryInterface(IID_IShellMenu, (void **)&parentMenu); // create favorites menu
hResult = psmd->punk->QueryInterface(IID_IShellMenu, reinterpret_cast<void **>(&parentMenu));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL); hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL);
@ -361,7 +371,8 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
favoritesHMenu = GetSubMenu(parentHMenu, 3); favoritesHMenu = GetSubMenu(parentHMenu, 3);
if (favoritesHMenu == NULL) if (favoritesHMenu == NULL)
return E_FAIL; return E_FAIL;
hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, IID_IShellMenu, (void **)&newMenu); hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
IID_IShellMenu, reinterpret_cast<void **>(&newMenu));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED); hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED);
@ -376,7 +387,7 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
hResult = SHBindToFolder(favoritesPIDL, &favoritesFolder); hResult = SHBindToFolder(favoritesPIDL, &favoritesFolder);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Favorites"), RegCreateKeyEx(HKEY_CURRENT_USER, szFavoritesKey,
0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition); 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition);
hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | 0x18); hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | 0x18);
ILFree(favoritesPIDL); ILFree(favoritesPIDL);
@ -400,7 +411,7 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::CallbackSM(LPSMDATA psmd, UINT uMsg, WP
break; break;
case SMC_GETINFO: case SMC_GETINFO:
{ {
SMINFO *infoPtr = (SMINFO *)lParam; SMINFO *infoPtr = reinterpret_cast<SMINFO *>(lParam);
if ((infoPtr->dwMask & SMIM_FLAGS) != 0) if ((infoPtr->dwMask & SMIM_FLAGS) != 0)
{ {
if (psmd->uId == FCIDM_MENU_FAVORITES) if (psmd->uId == FCIDM_MENU_FAVORITES)
@ -414,12 +425,12 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::CallbackSM(LPSMDATA psmd, UINT uMsg, WP
} }
if ((infoPtr->dwMask & SMIM_ICON) != 0) if ((infoPtr->dwMask & SMIM_ICON) != 0)
infoPtr->iIcon = -1; infoPtr->iIcon = -1;
}
return S_OK; return S_OK;
}
case SMC_GETSFINFO: case SMC_GETSFINFO:
break; break;
case SMC_GETOBJECT: case SMC_GETOBJECT:
return GetObject(psmd, *(IID *)wParam, (void **)lParam); return GetObject(psmd, *reinterpret_cast<IID *>(wParam), reinterpret_cast<void **>(lParam));
case SMC_GETSFOBJECT: case SMC_GETSFOBJECT:
break; break;
case SMC_SFEXEC: case SMC_SFEXEC:
@ -495,20 +506,20 @@ HRESULT CInternetToolbar::ReserveBorderSpace()
RECT neededBorderSpace; RECT neededBorderSpace;
HRESULT hResult; HRESULT hResult;
hResult = fSite->QueryInterface(IID_IDockingWindowSite, (void **)&dockingWindowSite); hResult = fSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&dockingWindowSite));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = dockingWindowSite->GetBorderDW((IDockingWindow *)this, &availableBorderSpace); hResult = dockingWindowSite->GetBorderDW(static_cast<IDockingWindow *>(this), &availableBorderSpace);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
SendMessage(fMainReBar, RB_SIZETORECT, RBSTR_CHANGERECT, (LPARAM)&availableBorderSpace); SendMessage(fMainReBar, RB_SIZETORECT, RBSTR_CHANGERECT, reinterpret_cast<LPARAM>(&availableBorderSpace));
neededBorderSpace.left = 0; neededBorderSpace.left = 0;
neededBorderSpace.top = availableBorderSpace.bottom - availableBorderSpace.top; neededBorderSpace.top = availableBorderSpace.bottom - availableBorderSpace.top;
if (fLocked == false) if (!fLocked)
neededBorderSpace.top += 3; neededBorderSpace.top += 3;
neededBorderSpace.right = 0; neededBorderSpace.right = 0;
neededBorderSpace.bottom = 0; neededBorderSpace.bottom = 0;
hResult = dockingWindowSite->SetBorderSpaceDW((IDockingWindow *)this, &neededBorderSpace); hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
return S_OK; return S_OK;
@ -524,22 +535,23 @@ HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **menuBar)
HWND ownerWindow; HWND ownerWindow;
HRESULT hResult; HRESULT hResult;
hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, IID_IShellMenu, (void **)menuBar); hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
IID_IShellMenu, reinterpret_cast<void **>(menuBar));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = fMenuCallback.QueryInterface(IID_IShellMenuCallback, (void **)&callback); hResult = fMenuCallback.QueryInterface(IID_IShellMenuCallback, reinterpret_cast<void **>(&callback));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = (*menuBar)->Initialize(callback, -1, ANCESTORDEFAULT, SMINIT_HORIZONTAL | SMINIT_TOPLEVEL); hResult = (*menuBar)->Initialize(callback, -1, ANCESTORDEFAULT, SMINIT_HORIZONTAL | SMINIT_TOPLEVEL);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = fSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow); hResult = fSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = oleWindow->GetWindow(&ownerWindow); hResult = oleWindow->GetWindow(&ownerWindow);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = fSite->QueryInterface(IID_IOleCommandTarget, (void **)&siteCommandTarget); hResult = fSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&siteCommandTarget));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = siteCommandTarget->Exec(&CGID_Explorer, 0x35, 0, NULL, &menuOut); hResult = siteCommandTarget->Exec(&CGID_Explorer, 0x35, 0, NULL, &menuOut);
@ -550,7 +562,7 @@ HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **menuBar)
hResult = (*menuBar)->SetMenu((HMENU)V_INTREF(&menuOut), ownerWindow, SMSET_DONTOWN); hResult = (*menuBar)->SetMenu((HMENU)V_INTREF(&menuOut), ownerWindow, SMSET_DONTOWN);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = (*menuBar)->QueryInterface(IID_IOleCommandTarget, (void **)&commandTarget); hResult = (*menuBar)->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = commandTarget->Exec(&CGID_MenuBand, 3, 1, NULL, NULL); hResult = commandTarget->Exec(&CGID_MenuBand, 3, 1, NULL, NULL);
@ -565,9 +577,10 @@ HRESULT CInternetToolbar::CreateBrandBand(IUnknown **logoBar)
HRESULT hResult; HRESULT hResult;
#if 1 #if 1
hResult = ::CreateBrandBand(IID_IUnknown, (void **)logoBar); hResult = ::CreateBrandBand(IID_IUnknown, reinterpret_cast<void **>(logoBar));
#else #else
hResult = CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **)logoBar); hResult = CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown,
reinterpret_cast<void **>(logoBar));
#endif #endif
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
@ -578,7 +591,7 @@ HRESULT CInternetToolbar::CreateToolsBar(IUnknown **toolsBar)
{ {
HRESULT hResult; HRESULT hResult;
hResult = ::CreateToolsBar(IID_IUnknown, (void **)toolsBar); hResult = ::CreateToolsBar(IID_IUnknown, reinterpret_cast<void **>(toolsBar));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
return S_OK; return S_OK;
@ -590,13 +603,14 @@ HRESULT CInternetToolbar::CreateAddressBand(IUnknown **toolsBar)
HRESULT hResult; HRESULT hResult;
#if 1 #if 1
hResult = ::CreateAddressBand(IID_IUnknown, (void **)toolsBar); hResult = ::CreateAddressBand(IID_IUnknown, reinterpret_cast<void **>(toolsBar));
#else #else
hResult = CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **)toolsBar); hResult = CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown,
reinterpret_cast<void **>(toolsBar));
#endif #endif
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = (*toolsBar)->QueryInterface(IID_IAddressBand, (void **)&addressBand); hResult = (*toolsBar)->QueryInterface(IID_IAddressBand, reinterpret_cast<void **>(&addressBand));
return S_OK; return S_OK;
} }
@ -604,7 +618,6 @@ HRESULT CInternetToolbar::LockUnlockToolbars(bool locked)
{ {
REBARBANDINFOW rebarBandInfo; REBARBANDINFOW rebarBandInfo;
int bandCount; int bandCount;
int x;
CDockSite *dockSite; CDockSite *dockSite;
HRESULT hResult; HRESULT hResult;
@ -614,16 +627,16 @@ HRESULT CInternetToolbar::LockUnlockToolbars(bool locked)
rebarBandInfo.cbSize = sizeof(rebarBandInfo); rebarBandInfo.cbSize = sizeof(rebarBandInfo);
rebarBandInfo.fMask = RBBIM_STYLE | RBBIM_LPARAM; rebarBandInfo.fMask = RBBIM_STYLE | RBBIM_LPARAM;
bandCount = (int)SendMessage(fMainReBar, RB_GETBANDCOUNT, 0, 0); bandCount = (int)SendMessage(fMainReBar, RB_GETBANDCOUNT, 0, 0);
for (x = 0; x < bandCount; x++) for (INT x = 0; x < bandCount; x++)
{ {
SendMessage(fMainReBar, RB_GETBANDINFOW, x, (LPARAM)&rebarBandInfo); SendMessage(fMainReBar, RB_GETBANDINFOW, x, (LPARAM)&rebarBandInfo);
dockSite = (CDockSite *)rebarBandInfo.lParam; dockSite = reinterpret_cast<CDockSite *>(rebarBandInfo.lParam);
if (dockSite != NULL) if (dockSite != NULL)
{ {
rebarBandInfo.fStyle &= ~(RBBS_NOGRIPPER | RBBS_GRIPPERALWAYS); rebarBandInfo.fStyle &= ~(RBBS_NOGRIPPER | RBBS_GRIPPERALWAYS);
if (dockSite->fFlags & CDockSite::ITF_NOGRIPPER || fLocked == true) if (dockSite->fFlags & CDockSite::ITF_NOGRIPPER || fLocked)
rebarBandInfo.fStyle |= RBBS_NOGRIPPER; rebarBandInfo.fStyle |= RBBS_NOGRIPPER;
if (dockSite->fFlags & CDockSite::ITF_GRIPPERALWAYS && fLocked == false) if (dockSite->fFlags & CDockSite::ITF_GRIPPERALWAYS && !fLocked)
rebarBandInfo.fStyle |= RBBS_GRIPPERALWAYS; rebarBandInfo.fStyle |= RBBS_GRIPPERALWAYS;
SendMessage(fMainReBar, RB_SETBANDINFOW, x, (LPARAM)&rebarBandInfo); SendMessage(fMainReBar, RB_SETBANDINFOW, x, (LPARAM)&rebarBandInfo);
} }
@ -664,17 +677,17 @@ HRESULT CInternetToolbar::CreateAndInitBandProxy()
CComPtr<IServiceProvider> serviceProvider; CComPtr<IServiceProvider> serviceProvider;
HRESULT hResult; HRESULT hResult;
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = serviceProvider->QueryService(SID_IBandProxy, IID_IBandProxy, (void **)&fBandProxy); hResult = serviceProvider->QueryService(SID_IBandProxy, IID_IBandProxy, reinterpret_cast<void **>(&fBandProxy));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
hResult = CreateBandProxy(IID_IBandProxy, (void **)&fBandProxy); hResult = CreateBandProxy(IID_IBandProxy, reinterpret_cast<void **>(&fBandProxy));
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = fBandProxy->SetSite(fSite); hResult = fBandProxy->SetSite(fSite);
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
} }
return S_OK; return S_OK;
@ -715,7 +728,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::ShowDW(BOOL fShow)
// show the bar here // show the bar here
hResult = ReserveBorderSpace(); hResult = ReserveBorderSpace();
hResult = fMenuBar->QueryInterface(IID_IDockingWindow, (void **)&dockingWindow); hResult = fMenuBar->QueryInterface(IID_IDockingWindow, reinterpret_cast<void **>(&dockingWindow));
hResult = dockingWindow->ShowDW(fShow); hResult = dockingWindow->ShowDW(fShow);
return S_OK; return S_OK;
} }
@ -725,7 +738,8 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::CloseDW(DWORD dwReserved)
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) HRESULT STDMETHODCALLTYPE CInternetToolbar::ResizeBorderDW(LPCRECT prcBorder,
IUnknown *punkToolbarSite, BOOL fReserved)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -772,15 +786,18 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
hResult = CreateMenuBar(&menuBar); hResult = CreateMenuBar(&menuBar);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
AddDockItem(menuBar, ITBBID_MENUBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS); AddDockItem(menuBar, ITBBID_MENUBAND,
hResult = menuBar->QueryInterface(IID_IOleWindow, (void **)&menuOleWindow); CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
hResult = menuBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&menuOleWindow));
hResult = menuOleWindow->GetWindow(&fMenuBandWindow); hResult = menuOleWindow->GetWindow(&fMenuBandWindow);
fMenuBar.Attach(menuBar.Detach()); // transfer the ref count fMenuBar.Attach(menuBar.Detach()); // transfer the ref count
hResult = CreateBrandBand(&logoBar); hResult = CreateBrandBand(&logoBar);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
AddDockItem(logoBar, ITBBID_BRANDBAND, CDockSite::ITF_NOGRIPPER | CDockSite::ITF_NOTITLE | CDockSite::ITF_FIXEDSIZE); AddDockItem(logoBar, ITBBID_BRANDBAND,
CDockSite::ITF_NOGRIPPER | CDockSite::ITF_NOTITLE | CDockSite::ITF_FIXEDSIZE);
fLogoBar.Attach(logoBar.Detach()); // transfer the ref count fLogoBar.Attach(logoBar.Detach()); // transfer the ref count
hResult = CreateToolsBar(&toolsBar); hResult = CreateToolsBar(&toolsBar);
@ -788,7 +805,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
return hResult; return hResult;
AddDockItem(toolsBar, ITBBID_TOOLSBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS); AddDockItem(toolsBar, ITBBID_TOOLSBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS);
fControlsBar.Attach(toolsBar.Detach()); // transfer the ref count fControlsBar.Attach(toolsBar.Detach()); // transfer the ref count
hResult = fControlsBar->QueryInterface(IID_IOleWindow, (void **)&toolbarOleWindow); hResult = fControlsBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&toolbarOleWindow));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = toolbarOleWindow->GetWindow(&fToolbarWindow); hResult = toolbarOleWindow->GetWindow(&fToolbarWindow);
@ -799,14 +816,15 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
AddDockItem(navigationBar, ITBBID_ADDRESSBAND, CDockSite::ITF_NEWBANDALWAYS); AddDockItem(navigationBar, ITBBID_ADDRESSBAND, CDockSite::ITF_NEWBANDALWAYS);
hResult = navigationBar->QueryInterface(IID_IOleWindow, (void **)&navigationOleWindow); hResult = navigationBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&navigationOleWindow));
hResult = navigationOleWindow->GetWindow(&fNavigationWindow); hResult = navigationOleWindow->GetWindow(&fNavigationWindow);
fNavigationBar.Attach(navigationBar.Detach()); fNavigationBar.Attach(navigationBar.Detach());
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryStatus(const GUID *pguidCmdGroup,
ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
{ {
if (IsEqualIID(*pguidCmdGroup, CGID_PrivCITCommands)) if (IsEqualIID(*pguidCmdGroup, CGID_PrivCITCommands))
{ {
@ -852,7 +870,8 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryStatus(const GUID *pguidCmdGrou
return E_FAIL; return E_FAIL;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) HRESULT STDMETHODCALLTYPE CInternetToolbar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{ {
if (IsEqualIID(*pguidCmdGroup, CGID_PrivCITCommands)) if (IsEqualIID(*pguidCmdGroup, CGID_PrivCITCommands))
{ {
@ -893,12 +912,14 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::GetTypeInfo(UINT iTInfo, LCID lcid,
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) HRESULT STDMETHODCALLTYPE CInternetToolbar::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) HRESULT STDMETHODCALLTYPE CInternetToolbar::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{ {
HRESULT hResult; HRESULT hResult;
@ -915,7 +936,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::Invoke(DISPID dispIdMember, REFIID r
return E_INVALIDARG; return E_INVALIDARG;
if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL || V_VT(&pDispParams->rgvarg[1]) != VT_I4) if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL || V_VT(&pDispParams->rgvarg[1]) != VT_I4)
return E_INVALIDARG; return E_INVALIDARG;
return CommandStateChanged(V_BOOL(&pDispParams->rgvarg[0]) == VARIANT_FALSE ? false : true, return CommandStateChanged(V_BOOL(&pDispParams->rgvarg[0]) != VARIANT_FALSE,
V_I4(&pDispParams->rgvarg[1])); V_I4(&pDispParams->rgvarg[1]));
case DISPID_DOWNLOADBEGIN: case DISPID_DOWNLOADBEGIN:
hResult = S_OK; hResult = S_OK;
@ -935,7 +956,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetCommandTarget(IUnknown *theTarget
HRESULT hResult; HRESULT hResult;
fCommandTarget.Release(); fCommandTarget.Release();
hResult = theTarget->QueryInterface(IID_IOleCommandTarget, (void **)&fCommandTarget); hResult = theTarget->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&fCommandTarget));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
fCommandCategory = *category; fCommandCategory = *category;
@ -952,11 +973,13 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::AddButtons(const GUID *pguidCmdGroup
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::AddString(const GUID *pguidCmdGroup, HINSTANCE param10, LPCTSTR param14, long *param18) HRESULT STDMETHODCALLTYPE CInternetToolbar::AddString(const GUID *pguidCmdGroup,
HINSTANCE param10, LPCTSTR param14, long *param18)
{ {
long result; long result;
result = (long)::SendMessage(fToolbarWindow, TB_ADDSTRINGW, (WPARAM)param10, (LPARAM)param14); result = (long)::SendMessage(fToolbarWindow, TB_ADDSTRINGW,
reinterpret_cast<WPARAM>(param10), reinterpret_cast<LPARAM>(param14));
*param18 = result; *param18 = result;
if (result == -1) if (result == -1)
return E_FAIL; return E_FAIL;
@ -984,7 +1007,8 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetState(const GUID *pguidCmdGroup,
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::AddBitmap(const GUID *pguidCmdGroup, long param10, long buttonCount, TBADDBITMAP *lParam, long *newIndex, COLORREF param20) HRESULT STDMETHODCALLTYPE CInternetToolbar::AddBitmap(const GUID *pguidCmdGroup, long param10, long buttonCount,
TBADDBITMAP *lParam, long *newIndex, COLORREF param20)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -997,12 +1021,14 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::GetBitmapSize(long *paramC)
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::SendToolbarMsg(const GUID *pguidCmdGroup, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *result) HRESULT STDMETHODCALLTYPE CInternetToolbar::SendToolbarMsg(const GUID *pguidCmdGroup, UINT uMsg,
WPARAM wParam, LPARAM lParam, LRESULT *result)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::SetImageList(const GUID *pguidCmdGroup, HIMAGELIST param10, HIMAGELIST param14, HIMAGELIST param18) HRESULT STDMETHODCALLTYPE CInternetToolbar::SetImageList(const GUID *pguidCmdGroup, HIMAGELIST param10,
HIMAGELIST param14, HIMAGELIST param18)
{ {
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -1025,6 +1051,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
HWND ownerWindow; HWND ownerWindow;
HWND dockContainer; HWND dockContainer;
HRESULT hResult; HRESULT hResult;
DWORD style;
if (pUnkSite == NULL) if (pUnkSite == NULL)
{ {
@ -1035,7 +1062,8 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
} }
else else
{ {
hResult = pUnkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow); // get window handle of owner
hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = oleWindow->GetWindow(&ownerWindow); hResult = oleWindow->GetWindow(&ownerWindow);
@ -1043,19 +1071,28 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
return hResult; return hResult;
if (ownerWindow == NULL) if (ownerWindow == NULL)
return E_FAIL; return E_FAIL;
// create dock container
fSite = pUnkSite; fSite = pUnkSite;
dockContainer = SHCreateWorkerWindowW(0, ownerWindow, 0, WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, NULL, 0); dockContainer = SHCreateWorkerWindowW(0, ownerWindow, 0,
WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, NULL, 0);
if (dockContainer == NULL) if (dockContainer == NULL)
return E_FAIL; return E_FAIL;
SubclassWindow(dockContainer); SubclassWindow(dockContainer);
fMainReBar = CreateWindow(REBARCLASSNAMEW, _T(""), WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT |
RBS_BANDBORDERS | RBS_REGISTERDROP | RBS_AUTOSIZE | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_TOP, // create rebar in dock container
style = WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT |
RBS_BANDBORDERS | RBS_REGISTERDROP | RBS_AUTOSIZE | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_TOP;
fMainReBar = CreateWindow(REBARCLASSNAMEW, NULL, style,
0, 0, 700, 60, dockContainer, NULL, _AtlBaseModule.GetModuleInstance(), NULL); 0, 0, 700, 60, dockContainer, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
if (fMainReBar == NULL) if (fMainReBar == NULL)
return E_FAIL; return E_FAIL;
hResult = pUnkSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService, (void **)&browserService); // take advice to watch events
hResult = AtlAdvise(browserService, (IDispatch *)this, DIID_DWebBrowserEvents, &fAdviseCookie); hResult = pUnkSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
hResult = serviceProvider->QueryService(
SID_SShellBrowser, IID_IBrowserService, reinterpret_cast<void **>(&browserService));
hResult = AtlAdvise(browserService, static_cast<IDispatch *>(this), DIID_DWebBrowserEvents, &fAdviseCookie);
} }
return S_OK; return S_OK;
} }
@ -1082,25 +1119,26 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryService(REFGUID guidService, RE
if (fBandProxy.p == NULL) if (fBandProxy.p == NULL)
{ {
hResult = CreateAndInitBandProxy(); hResult = CreateAndInitBandProxy();
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
} }
return fBandProxy->QueryInterface(riid, ppvObject); return fBandProxy->QueryInterface(riid, ppvObject);
} }
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
return serviceProvider->QueryService(guidService, riid, ppvObject); return serviceProvider->QueryService(guidService, riid, ppvObject);
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) HRESULT STDMETHODCALLTYPE CInternetToolbar::OnWinEvent(
HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{ {
CComPtr<IWinEventHandler> menuWinEventHandler; CComPtr<IWinEventHandler> menuWinEventHandler;
HRESULT hResult; HRESULT hResult;
if (fMenuBar.p != NULL) if (fMenuBar.p != NULL)
{ {
hResult = fMenuBar->QueryInterface(IID_IWinEventHandler, (void **)&menuWinEventHandler); hResult = fMenuBar->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&menuWinEventHandler));
return menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam, lParam, theResult); return menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam, lParam, theResult);
} }
return E_FAIL; return E_FAIL;
@ -1121,14 +1159,15 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::EnumBands(UINT uBand, DWORD *pdwBand
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName) HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryBand(DWORD dwBandID,
IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
{ {
if (ppstb == NULL) if (ppstb == NULL)
return E_POINTER; return E_POINTER;
if (dwBandID == ITBBID_MENUBAND && fMenuBar.p != NULL) if (dwBandID == ITBBID_MENUBAND && fMenuBar.p != NULL)
return fMenuBar->QueryInterface(IID_IDeskBand, (void **)ppstb); return fMenuBar->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(ppstb));
if (dwBandID == ITBBID_BRANDBAND && fLogoBar.p != NULL) if (dwBandID == ITBBID_BRANDBAND && fLogoBar.p != NULL)
return fLogoBar->QueryInterface(IID_IDeskBand, (void **)ppstb); return fLogoBar->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(ppstb));
*ppstb = NULL; *ppstb = NULL;
return E_FAIL; return E_FAIL;
} }
@ -1164,11 +1203,12 @@ LRESULT CInternetToolbar::OnTravelBack(WORD wNotifyCode, WORD wID, HWND hWndCtl,
CComPtr<IWebBrowser> webBrowser; CComPtr<IWebBrowser> webBrowser;
HRESULT hResult; HRESULT hResult;
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED (hResult)) if (FAILED(hResult))
return 0; return 0;
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IWebBrowser, (void **)&webBrowser); hResult = serviceProvider->QueryService(SID_SShellBrowser,
if (FAILED (hResult)) IID_IWebBrowser, reinterpret_cast<void **>(&webBrowser));
if (FAILED(hResult))
return 0; return 0;
hResult = webBrowser->GoBack(); hResult = webBrowser->GoBack();
return 1; return 1;
@ -1180,11 +1220,12 @@ LRESULT CInternetToolbar::OnTravelForward(WORD wNotifyCode, WORD wID, HWND hWndC
CComPtr<IWebBrowser> webBrowser; CComPtr<IWebBrowser> webBrowser;
HRESULT hResult; HRESULT hResult;
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED (hResult)) if (FAILED(hResult))
return 0; return 0;
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IWebBrowser, (void **)&webBrowser); hResult = serviceProvider->QueryService(
if (FAILED (hResult)) SID_SShellBrowser, IID_IWebBrowser, reinterpret_cast<void **>(&webBrowser));
if (FAILED(hResult))
return 0; return 0;
hResult = webBrowser->GoForward(); hResult = webBrowser->GoForward();
return 1; return 1;
@ -1195,8 +1236,8 @@ LRESULT CInternetToolbar::OnUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
CComPtr<IOleCommandTarget> oleCommandTarget; CComPtr<IOleCommandTarget> oleCommandTarget;
HRESULT hResult; HRESULT hResult;
hResult = fSite->QueryInterface(IID_IOleCommandTarget, (void **)&oleCommandTarget); hResult = fSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = oleCommandTarget->Exec(&CGID_ShellBrowser, IDM_GOTO_UPONELEVEL, 0, NULL, NULL); hResult = oleCommandTarget->Exec(&CGID_ShellBrowser, IDM_GOTO_UPONELEVEL, 0, NULL, NULL);
return 1; return 1;
@ -1218,14 +1259,15 @@ LRESULT CInternetToolbar::OnSearch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
commandInfo.lpParameters = searchGUID; commandInfo.lpParameters = searchGUID;
commandInfo.nShow = SW_SHOWNORMAL; commandInfo.nShow = SW_SHOWNORMAL;
hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER, IID_IContextMenu, (void **)&contextMenu); hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
if (FAILED (hResult)) IID_IContextMenu, reinterpret_cast<void **>(&contextMenu));
if (FAILED(hResult))
return 0; return 0;
hResult = contextMenu->QueryInterface(IID_IObjectWithSite, (void **)&objectWithSite); hResult = contextMenu->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&objectWithSite));
if (FAILED (hResult)) if (FAILED(hResult))
return 0; return 0;
hResult = objectWithSite->SetSite(fSite); hResult = objectWithSite->SetSite(fSite);
if (FAILED (hResult)) if (FAILED(hResult))
return 0; return 0;
hResult = contextMenu->InvokeCommand(&commandInfo); hResult = contextMenu->InvokeCommand(&commandInfo);
hResult = objectWithSite->SetSite(NULL); hResult = objectWithSite->SetSite(NULL);
@ -1237,8 +1279,8 @@ LRESULT CInternetToolbar::OnFolders(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
CComPtr<IOleCommandTarget> oleCommandTarget; CComPtr<IOleCommandTarget> oleCommandTarget;
HRESULT hResult; HRESULT hResult;
hResult = fSite->QueryInterface(IID_IOleCommandTarget, (void **)&oleCommandTarget); hResult = fSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
if (FAILED (hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = oleCommandTarget->Exec(&CGID_Explorer, 0x23, 0, NULL, NULL); hResult = oleCommandTarget->Exec(&CGID_Explorer, 0x23, 0, NULL, NULL);
return 1; return 1;
@ -1277,20 +1319,22 @@ LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bH
bHandled = FALSE; bHandled = FALSE;
return 0; return 0;
} }
SendMessage(fToolbarWindow, TB_GETRECT, notifyInfo->iItem, (LPARAM)&bounds); SendMessage(fToolbarWindow, TB_GETRECT, notifyInfo->iItem, reinterpret_cast<LPARAM>(&bounds));
::MapWindowPoints(fToolbarWindow, NULL, (POINT *)&bounds, 2); ::MapWindowPoints(fToolbarWindow, NULL, reinterpret_cast<POINT *>(&bounds), 2);
switch (notifyInfo->iItem) switch (notifyInfo->iItem)
{ {
case gBackCommandID: case gBackCommandID:
newMenu = CreatePopupMenu(); newMenu = CreatePopupMenu();
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService, (void **)&browserService); hResult = serviceProvider->QueryService(
SID_SShellBrowser, IID_IBrowserService, reinterpret_cast<void **>(&browserService));
hResult = browserService->GetTravelLog(&travelLog); hResult = browserService->GetTravelLog(&travelLog);
hResult = travelLog->InsertMenuEntries(browserService, newMenu, 0, 1, 9, TLMENUF_BACK); hResult = travelLog->InsertMenuEntries(browserService, newMenu, 0, 1, 9, TLMENUF_BACK);
hResult = browserService->QueryInterface(IID_IOleCommandTarget, (void **)&commandTarget); hResult = browserService->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
commandInfo.cmdID = 0x1d; commandInfo.cmdID = 0x1d;
hResult = commandTarget->QueryStatus(&CGID_Explorer, 1, &commandInfo, NULL); hResult = commandTarget->QueryStatus(&CGID_Explorer, 1, &commandInfo, NULL);
if ((commandInfo.cmdf & (OLECMDF_ENABLED | OLECMDF_LATCHED)) == OLECMDF_ENABLED && travelLog->CountEntries(browserService) > 1) if ((commandInfo.cmdf & (OLECMDF_ENABLED | OLECMDF_LATCHED)) == OLECMDF_ENABLED &&
travelLog->CountEntries(browserService) > 1)
{ {
AppendMenu(newMenu, MF_SEPARATOR, -1, L""); AppendMenu(newMenu, MF_SEPARATOR, -1, L"");
AppendMenu(newMenu, MF_STRING /* | MF_OWNERDRAW */, IDM_EXPLORERBAR_HISTORY, L"&History\tCtrl+H"); AppendMenu(newMenu, MF_STRING /* | MF_OWNERDRAW */, IDM_EXPLORERBAR_HISTORY, L"&History\tCtrl+H");
@ -1311,14 +1355,16 @@ LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bH
break; break;
case gForwardCommandID: case gForwardCommandID:
newMenu = CreatePopupMenu(); newMenu = CreatePopupMenu();
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider); hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService, (void **)&browserService); hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService,
reinterpret_cast<void **>(&browserService));
hResult = browserService->GetTravelLog(&travelLog); hResult = browserService->GetTravelLog(&travelLog);
hResult = travelLog->InsertMenuEntries(browserService, newMenu, 0, 1, 9, TLMENUF_FORE); hResult = travelLog->InsertMenuEntries(browserService, newMenu, 0, 1, 9, TLMENUF_FORE);
hResult = browserService->QueryInterface(IID_IOleCommandTarget, (void **)&commandTarget); hResult = browserService->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
commandInfo.cmdID = 0x1d; commandInfo.cmdID = 0x1d;
hResult = commandTarget->QueryStatus(&CGID_Explorer, 1, &commandInfo, NULL); hResult = commandTarget->QueryStatus(&CGID_Explorer, 1, &commandInfo, NULL);
if ((commandInfo.cmdf & (OLECMDF_ENABLED | OLECMDF_LATCHED)) == OLECMDF_ENABLED && travelLog->CountEntries(browserService) > 1) if ((commandInfo.cmdf & (OLECMDF_ENABLED | OLECMDF_LATCHED)) == OLECMDF_ENABLED &&
travelLog->CountEntries(browserService) > 1)
{ {
AppendMenu(newMenu, MF_SEPARATOR, -1, L""); AppendMenu(newMenu, MF_SEPARATOR, -1, L"");
AppendMenu(newMenu, MF_STRING /* | MF_OWNERDRAW */, IDM_EXPLORERBAR_HISTORY, L"&History\tCtrl+H"); AppendMenu(newMenu, MF_STRING /* | MF_OWNERDRAW */, IDM_EXPLORERBAR_HISTORY, L"&History\tCtrl+H");
@ -1343,7 +1389,7 @@ LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bH
HRESULT hResult; HRESULT hResult;
V_VT(&inValue) = VT_INT_PTR; V_VT(&inValue) = VT_INT_PTR;
V_INTREF(&inValue) = (INT *)&bounds; V_INTREF(&inValue) = reinterpret_cast<INT *>(&bounds);
if (fCommandTarget.p != NULL) if (fCommandTarget.p != NULL)
hResult = fCommandTarget->Exec(&fCommandCategory, 0x7031, 1, &inValue, &outValue); hResult = fCommandTarget->Exec(&fCommandCategory, 0x7031, 1, &inValue, &outValue);
@ -1369,7 +1415,7 @@ LRESULT CInternetToolbar::OnNavigateCommand(UINT uMsg, WPARAM wParam, LPARAM lPa
LRESULT theResult; LRESULT theResult;
HRESULT hResult; HRESULT hResult;
hResult = fNavigationBar->QueryInterface(IID_IWinEventHandler, (void **)&winEventHandler); hResult = fNavigationBar->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
hResult = winEventHandler->OnWinEvent(m_hWnd, uMsg, wParam, lParam, &theResult); hResult = winEventHandler->OnWinEvent(m_hWnd, uMsg, wParam, lParam, &theResult);
if (SUCCEEDED(hResult)) if (SUCCEEDED(hResult))
return theResult; return theResult;
@ -1448,7 +1494,8 @@ LRESULT CInternetToolbar::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &
{ {
if (wParam != SIZE_MINIMIZED) if (wParam != SIZE_MINIMIZED)
{ {
::SetWindowPos(fMainReBar, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam), SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE); ::SetWindowPos(fMainReBar, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam),
SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE);
} }
return 1; return 1;
} }
@ -1473,7 +1520,7 @@ LRESULT CInternetToolbar::OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandle
wchar_t tempString[300]; wchar_t tempString[300];
HRESULT hResult; HRESULT hResult;
pTTTW = (TOOLTIPTEXTW *)pNMHDR; pTTTW = reinterpret_cast<TOOLTIPTEXTW *>(pNMHDR);
if ((pTTTW->uFlags & TTF_IDISHWND) != 0) if ((pTTTW->uFlags & TTF_IDISHWND) != 0)
nID = ::GetDlgCtrlID((HWND)pNMHDR->idFrom); nID = ::GetDlgCtrlID((HWND)pNMHDR->idFrom);
else else
@ -1484,9 +1531,10 @@ LRESULT CInternetToolbar::OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandle
if (nID == (UINT)gBackCommandID || nID == (UINT)gForwardCommandID) if (nID == (UINT)gBackCommandID || nID == (UINT)gForwardCommandID)
{ {
// TODO: Should this call QueryService? // TODO: Should this call QueryService?
hResult = fSite->QueryInterface(IID_IBrowserService, (void **)&browserService); hResult = fSite->QueryInterface(IID_IBrowserService, reinterpret_cast<void **>(&browserService));
hResult = browserService->GetTravelLog(&travelLog); hResult = browserService->GetTravelLog(&travelLog);
hResult = travelLog->GetToolTipText(browserService, nID == (UINT)gBackCommandID ? TLOG_BACK : TLOG_FORE, hResult = travelLog->GetToolTipText(browserService,
(nID == (UINT)gBackCommandID) ? TLOG_BACK : TLOG_FORE,
0, tempString, 299); 0, tempString, 299);
if (FAILED(hResult)) if (FAILED(hResult))
{ {
@ -1497,7 +1545,8 @@ LRESULT CInternetToolbar::OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandle
else else
tempString[0] = 0; tempString[0] = 0;
wcsncpy (pTTTW->szText, tempString, sizeof (pTTTW->szText) / sizeof (wchar_t)); wcsncpy (pTTTW->szText, tempString, sizeof (pTTTW->szText) / sizeof (wchar_t));
::SetWindowPos (pNMHDR->hwndFrom, HWND_TOP, 0, 0, 0, 0, SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); ::SetWindowPos(pNMHDR->hwndFrom, HWND_TOP, 0, 0, 0, 0,
SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
return 0; return 0;
} }
return 0; return 0;
@ -1513,13 +1562,14 @@ LRESULT CInternetToolbar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
notifyHeader = (NMHDR *)lParam; notifyHeader = (NMHDR *)lParam;
if (fMenuBar.p != NULL && notifyHeader->hwndFrom == fMenuBandWindow) if (fMenuBar.p != NULL && notifyHeader->hwndFrom == fMenuBandWindow)
{ {
hResult = fMenuBar->QueryInterface(IID_IWinEventHandler, (void **)&menuWinEventHandler); hResult = fMenuBar->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&menuWinEventHandler));
hResult = menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam, lParam, &theResult); hResult = menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam, lParam, &theResult);
return theResult; return theResult;
} }
if (fNavigationBar.p != NULL && notifyHeader->hwndFrom == fNavigationWindow) if (fNavigationBar.p != NULL && notifyHeader->hwndFrom == fNavigationWindow)
{ {
hResult = fNavigationBar->QueryInterface(IID_IWinEventHandler, (void **)&menuWinEventHandler); hResult = fNavigationBar->QueryInterface(
IID_IWinEventHandler, reinterpret_cast<void **>(&menuWinEventHandler));
hResult = menuWinEventHandler->OnWinEvent(m_hWnd, uMsg, wParam, lParam, &theResult); hResult = menuWinEventHandler->OnWinEvent(m_hWnd, uMsg, wParam, lParam, &theResult);
return theResult; return theResult;
} }
@ -1537,8 +1587,8 @@ HRESULT CreateInternetToolbar(REFIID riid, void **ppv)
ATLTRY (theToolbar = new CComObject<CInternetToolbar>); ATLTRY (theToolbar = new CComObject<CInternetToolbar>);
if (theToolbar == NULL) if (theToolbar == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hResult = theToolbar->QueryInterface (riid, (void **)ppv); hResult = theToolbar->QueryInterface (riid, reinterpret_cast<void **>(ppv));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
delete theToolbar; delete theToolbar;
return hResult; return hResult;

View file

@ -198,7 +198,7 @@ public:
LRESULT OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled); LRESULT OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled);
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
BEGIN_MSG_MAP(CInternetToolbar) BEGIN_MSG_MAP(CInternetToolbar)
COMMAND_ID_HANDLER(gBackCommandID, OnTravelBack) COMMAND_ID_HANDLER(gBackCommandID, OnTravelBack)
COMMAND_ID_HANDLER(gForwardCommandID, OnTravelForward) COMMAND_ID_HANDLER(gForwardCommandID, OnTravelForward)
COMMAND_ID_HANDLER(gUpLevelCommandID, OnUpLevel) COMMAND_ID_HANDLER(gUpLevelCommandID, OnUpLevel)
@ -214,19 +214,19 @@ BEGIN_MSG_MAP(CInternetToolbar)
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText) NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
MESSAGE_HANDLER(WM_NOTIFY, OnNotify) MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
END_MSG_MAP() END_MSG_MAP()
DECLARE_REGISTRY_RESOURCEID(IDR_INTERNETTOOLBAR) DECLARE_REGISTRY_RESOURCEID(IDR_INTERNETTOOLBAR)
DECLARE_NOT_AGGREGATABLE(CInternetToolbar) DECLARE_NOT_AGGREGATABLE(CInternetToolbar)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CInternetToolbar) BEGIN_COM_MAP(CInternetToolbar)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow) COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
// COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) // COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
COM_INTERFACE_ENTRY_IID(IID_IPersistStreamInit, IPersistStreamInit) COM_INTERFACE_ENTRY_IID(IID_IPersistStreamInit, IPersistStreamInit)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch) COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
@ -236,5 +236,5 @@ BEGIN_COM_MAP(CInternetToolbar)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler) COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite) COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
END_COM_MAP() END_COM_MAP()
}; };

View file

@ -64,7 +64,7 @@ public:
*pdwCookie = 0; *pdwCookie = 0;
if (pUnkSink == NULL || pdwCookie == NULL) if (pUnkSink == NULL || pdwCookie == NULL)
return E_POINTER; return E_POINTER;
hResult = pUnkSink->QueryInterface(IID_IDispatch, (void **)&adviseSink); hResult = pUnkSink->QueryInterface(IID_IDispatch, reinterpret_cast<void **>(&adviseSink));
if (FAILED(hResult)) if (FAILED(hResult))
{ {
if (hResult == E_NOINTERFACE) if (hResult == E_NOINTERFACE)

View file

@ -41,13 +41,13 @@ public:
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite); virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite); virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
DECLARE_REGISTRY_RESOURCEID(IDR_REGTREEOPTIONS) DECLARE_REGISTRY_RESOURCEID(IDR_REGTREEOPTIONS)
DECLARE_NOT_AGGREGATABLE(CRegTreeOptions) DECLARE_NOT_AGGREGATABLE(CRegTreeOptions)
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CRegTreeOptions) BEGIN_COM_MAP(CRegTreeOptions)
COM_INTERFACE_ENTRY_IID(IID_IRegTreeOptions, IRegTreeOptions) COM_INTERFACE_ENTRY_IID(IID_IRegTreeOptions, IRegTreeOptions)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
END_COM_MAP() END_COM_MAP()
}; };

File diff suppressed because it is too large Load diff

View file

@ -228,11 +228,11 @@ HRESULT STDMETHODCALLTYPE CToolsBand::SetSite(IUnknown* pUnkSite)
fDockSite->Release(); fDockSite->Release();
if (pUnkSite == NULL) if (pUnkSite == NULL)
return S_OK; return S_OK;
hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, (void **)&fDockSite); hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&fDockSite));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
parentWindow = NULL; parentWindow = NULL;
hResult = pUnkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow); hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (SUCCEEDED(hResult)) if (SUCCEEDED(hResult))
{ {
oleWindow->GetWindow(&parentWindow); oleWindow->GetWindow(&parentWindow);
@ -241,7 +241,7 @@ HRESULT STDMETHODCALLTYPE CToolsBand::SetSite(IUnknown* pUnkSite)
if (!::IsWindow(parentWindow)) if (!::IsWindow(parentWindow))
return E_FAIL; return E_FAIL;
toolbar = CreateWindowEx(TBSTYLE_EX_DOUBLEBUFFER, TOOLBARCLASSNAMEW, _T(""), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | toolbar = CreateWindowEx(TBSTYLE_EX_DOUBLEBUFFER, TOOLBARCLASSNAMEW, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | TBSTYLE_TOOLTIPS | TBSTYLE_TRANSPARENT | TBSTYLE_REGISTERDROP | TBSTYLE_LIST | TBSTYLE_FLAT | WS_CLIPCHILDREN | TBSTYLE_TOOLTIPS | TBSTYLE_TRANSPARENT | TBSTYLE_REGISTERDROP | TBSTYLE_LIST | TBSTYLE_FLAT |
CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_TOP, 0, 0, 500, 20, parentWindow, NULL, CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_TOP, 0, 0, 500, 20, parentWindow, NULL,
_AtlBaseModule.GetModuleInstance(), 0); _AtlBaseModule.GetModuleInstance(), 0);
@ -252,10 +252,13 @@ HRESULT STDMETHODCALLTYPE CToolsBand::SetSite(IUnknown* pUnkSite)
SendMessage(WM_USER + 100, GetSystemMetrics(SM_CXEDGE) / 2, 0); SendMessage(WM_USER + 100, GetSystemMetrics(SM_CXEDGE) / 2, 0);
SendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); SendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
SendMessage(TB_SETMAXTEXTROWS, 1, 0); SendMessage(TB_SETMAXTEXTROWS, 1, 0);
SendMessage(TB_SETEXTENDEDSTYLE, TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS, TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS); SendMessage(TB_SETEXTENDEDSTYLE, TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS,
TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS);
HINSTANCE shell32Instance = GetModuleHandle(_T("shell32.dll")); HINSTANCE shell32Instance = GetModuleHandle(_T("shell32.dll"));
HBITMAP imageBitmap = (HBITMAP)LoadImage(shell32Instance, MAKEINTRESOURCE(214), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION); HBITMAP imageBitmap = reinterpret_cast<HBITMAP>(
LoadImage(shell32Instance, MAKEINTRESOURCE(214),
IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION));
DIBSECTION bitmapInfo; DIBSECTION bitmapInfo;
GetObjectW(imageBitmap, sizeof(bitmapInfo), &bitmapInfo); GetObjectW(imageBitmap, sizeof(bitmapInfo), &bitmapInfo);
@ -363,7 +366,7 @@ HRESULT STDMETHODCALLTYPE CToolsBand::GetSizeMax(ULARGE_INTEGER *pcbSize)
LRESULT CToolsBand::OnGetButtonInfo(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled) LRESULT CToolsBand::OnGetButtonInfo(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled)
{ {
TBNOTIFYW *pTBntf = (TBNOTIFYW *)pNMHDR; TBNOTIFYW *pTBntf = reinterpret_cast<TBNOTIFYW *>(pNMHDR);
if (pTBntf->iItem >= 0 && pTBntf->iItem < (numShownButtons + numHiddenButtons)) if (pTBntf->iItem >= 0 && pTBntf->iItem < (numShownButtons + numHiddenButtons))
{ {
@ -386,8 +389,8 @@ HRESULT CreateToolsBar(REFIID riid, void **ppv)
ATLTRY (theMenuBar = new CComObject<CToolsBand>); ATLTRY (theMenuBar = new CComObject<CToolsBand>);
if (theMenuBar == NULL) if (theMenuBar == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface (riid, (void **)ppv); hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
delete theMenuBar; delete theMenuBar;
return hResult; return hResult;

View file

@ -141,7 +141,7 @@ HRESULT STDMETHODCALLTYPE CTravelEntry::Invoke(IUnknown *punk)
CComPtr<IStream> globalStream; CComPtr<IStream> globalStream;
HRESULT hResult; HRESULT hResult;
hResult = punk->QueryInterface(IID_IPersistHistory, (void **)&persistHistory); hResult = punk->QueryInterface(IID_IPersistHistory, reinterpret_cast<void **>(&persistHistory));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = CreateStreamOnHGlobal(fPersistState, FALSE, &globalStream); hResult = CreateStreamOnHGlobal(fPersistState, FALSE, &globalStream);
@ -166,7 +166,7 @@ HRESULT STDMETHODCALLTYPE CTravelEntry::Update(IUnknown *punk, BOOL fIsLocalAnch
fPIDL = NULL; fPIDL = NULL;
GlobalFree(fPersistState); GlobalFree(fPersistState);
fPersistState = NULL; fPersistState = NULL;
hResult = punk->QueryInterface(IID_ITravelLogClient, (void **)&travelLogClient); hResult = punk->QueryInterface(IID_ITravelLogClient, reinterpret_cast<void **>(&travelLogClient));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = travelLogClient->GetWindowData(&windowData); hResult = travelLogClient->GetWindowData(&windowData);
@ -174,7 +174,7 @@ HRESULT STDMETHODCALLTYPE CTravelEntry::Update(IUnknown *punk, BOOL fIsLocalAnch
return hResult; return hResult;
fPIDL = windowData.pidl; fPIDL = windowData.pidl;
// TODO: Properly free the windowData // TODO: Properly free the windowData
hResult = punk->QueryInterface(IID_IPersistHistory, (void **)&persistHistory); hResult = punk->QueryInterface(IID_IPersistHistory, reinterpret_cast<void **>(&persistHistory));
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
globalStorage = GlobalAlloc(GMEM_FIXED, 0); globalStorage = GlobalAlloc(GMEM_FIXED, 0);
@ -363,7 +363,7 @@ HRESULT STDMETHODCALLTYPE CTravelLog::GetTravelEntry(IUnknown *punk, int iOffset
hResult = FindRelativeEntry(iOffset, &destinationEntry); hResult = FindRelativeEntry(iOffset, &destinationEntry);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
return destinationEntry->QueryInterface(IID_ITravelEntry, (void **)ppte); return destinationEntry->QueryInterface(IID_ITravelEntry, reinterpret_cast<void **>(ppte));
} }
HRESULT STDMETHODCALLTYPE CTravelLog::FindTravelEntry(IUnknown *punk, LPCITEMIDLIST pidl, ITravelEntry **ppte) HRESULT STDMETHODCALLTYPE CTravelLog::FindTravelEntry(IUnknown *punk, LPCITEMIDLIST pidl, ITravelEntry **ppte)
@ -424,7 +424,8 @@ static void FixAmpersands(wchar_t *buffer)
wcscpy(buffer, tempBuffer); wcscpy(buffer, tempBuffer);
} }
HRESULT STDMETHODCALLTYPE CTravelLog::InsertMenuEntries(IUnknown *punk, HMENU hmenu, int nPos, int idFirst, int idLast, DWORD dwFlags) HRESULT STDMETHODCALLTYPE CTravelLog::InsertMenuEntries(IUnknown *punk, HMENU hmenu,
int nPos, int idFirst, int idLast, DWORD dwFlags)
{ {
CTravelEntry *currentItem; CTravelEntry *currentItem;
MENUITEMINFO menuItemInfo; MENUITEMINFO menuItemInfo;
@ -570,8 +571,8 @@ HRESULT CreateTravelLog(REFIID riid, void **ppv)
ATLTRY (theTravelLog = new CComObject<CTravelLog>); ATLTRY (theTravelLog = new CComObject<CTravelLog>);
if (theTravelLog == NULL) if (theTravelLog == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hResult = theTravelLog->QueryInterface (riid, (void **)ppv); hResult = theTravelLog->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED (hResult)) if (FAILED(hResult))
{ {
delete theTravelLog; delete theTravelLog;
return hResult; return hResult;