[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)
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;
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;
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;
fObjectCount++;
return S_OK;
@ -75,9 +76,10 @@ HRESULT STDMETHODCALLTYPE CACLMulti::Remove(IUnknown *punk)
if (fObjects[i].punk == punk)
{
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--;
fObjects = reinterpret_cast<struct ACLMultiSublist *>(CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * fObjectCount));
fObjects = reinterpret_cast<ACLMultiSublist *>(
CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * fObjectCount));
return S_OK;
}

View file

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

View file

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

View file

@ -102,31 +102,31 @@ public:
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
BEGIN_MSG_MAP(CAddressBand)
NOTIFY_CODE_HANDLER(NM_CLICK, OnNotifyClick)
NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChanging)
END_MSG_MAP()
BEGIN_MSG_MAP(CAddressBand)
NOTIFY_CODE_HANDLER(NM_CLICK, OnNotifyClick)
NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChanging)
END_MSG_MAP()
DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSBAND)
DECLARE_NOT_AGGREGATABLE(CAddressBand)
DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSBAND)
DECLARE_NOT_AGGREGATABLE(CAddressBand)
DECLARE_PROTECT_FINAL_CONSTRUCT()
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CAddressBand)
COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IAddressBand, IAddressBand)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
END_COM_MAP()
BEGIN_COM_MAP(CAddressBand)
COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IAddressBand, IAddressBand)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
END_COM_MAP()
};

View file

@ -90,7 +90,8 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Save(long paramC)
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
return E_NOTIMPL;
@ -101,12 +102,14 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::IsWindowOwner(HWND hWnd)
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;
}
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;
}
@ -121,12 +124,14 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::GetTypeInfo(UINT iTInfo, LCID lcid, I
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;
}
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
return E_NOTIMPL;
@ -171,8 +176,8 @@ HRESULT CreateAddressEditBox(REFIID riid, void **ppv)
ATLTRY (theMenuBar = new CComObject<CAddressEditBox>);
if (theMenuBar == NULL)
return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface (riid, (void **)ppv);
if (FAILED (hResult))
hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED(hResult))
{
delete theMenuBar;
return hResult;

View file

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

View file

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

View file

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

View file

@ -1,8 +1,8 @@
/*
* Rebar band site
* Rebar band site
*
* Copyright 2007 Hervé Poussineau
* Copyright 2009 Andrew Hill
* Copyright 2007 Hervé Poussineau
* Copyright 2009 Andrew Hill
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -67,7 +67,7 @@ void CBandSiteBase::FreeBand(struct BandObject *Band)
DWORD CBandSiteBase::GetBandSiteViewMode()
{
DWORD dwStyle;
DWORD dwStyle;
/* FIXME: What about DBIF_VIEWMODE_FLOATING and DBIF_VIEWMODE_TRANSPARENT? */
dwStyle = GetWindowLongPtr(fRebarWindow, GWL_STYLE);
@ -80,7 +80,7 @@ DWORD CBandSiteBase::GetBandSiteViewMode()
VOID CBandSiteBase::BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi)
{
memset(prbi, 0, sizeof(*prbi));
ZeroMemory(prbi, sizeof(*prbi));
prbi->cbSize = sizeof(*prbi);
prbi->fMask = RBBIM_ID;
@ -156,12 +156,12 @@ VOID CBandSiteBase::BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *
HRESULT CBandSiteBase::UpdateSingleBand(struct BandObject *Band)
{
REBARBANDINFOW rbi;
DWORD dwViewMode;
UINT uBand;
HRESULT hRet;
REBARBANDINFOW rbi;
DWORD dwViewMode;
UINT uBand;
HRESULT hRet;
memset(&Band->dbi, 0, sizeof(Band->dbi));
ZeroMemory(&Band->dbi, sizeof(Band->dbi));
Band->dbi.dwMask = DBIM_MINSIZE | DBIM_MAXSIZE | DBIM_INTEGRAL |
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);
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");
}
@ -196,15 +196,15 @@ HRESULT CBandSiteBase::UpdateSingleBand(struct BandObject *Band)
HRESULT CBandSiteBase::UpdateAllBands()
{
LONG i;
HRESULT hRet;
LONG i;
HRESULT hRet;
for (i = 0; i < fBandsAllocated; i++)
{
if (fBands[i].DeskBand != NULL)
{
hRet = UpdateSingleBand(&fBands[i]);
if (!SUCCEEDED(hRet))
if (FAILED(hRet))
return hRet;
}
}
@ -214,7 +214,7 @@ HRESULT CBandSiteBase::UpdateAllBands()
HRESULT CBandSiteBase::UpdateBand(DWORD dwBandID)
{
struct BandObject *Band;
struct BandObject *Band;
Band = GetBandByID(dwBandID);
if (Band == NULL)
@ -225,9 +225,9 @@ HRESULT CBandSiteBase::UpdateBand(DWORD dwBandID)
struct CBandSiteBase::BandObject *CBandSiteBase::GetBandFromHwnd(HWND hwnd)
{
HRESULT hRet;
HWND hWndBand;
LONG i;
HRESULT hRet;
HWND hWndBand;
LONG i;
for (i = 0; i < fBandsAllocated; i++)
{
@ -258,8 +258,7 @@ CBandSiteBase::~CBandSiteBase()
if (fBands != NULL)
{
int i;
for (i = 0; i < fBandsAllocated; i++)
for (INT i = 0; i < fBandsAllocated; i++)
{
if (fBands[i].DeskBand != NULL)
FreeBand(&fBands[i]);
@ -271,32 +270,31 @@ CBandSiteBase::~CBandSiteBase()
HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
{
INT i;
LONG NewAllocated;
struct BandObject *NewBand = NULL;
CComPtr<IDeskBand> DeskBand;
CComPtr<IObjectWithSite> ObjWithSite;
CComPtr<IOleWindow> OleWindow;
CComPtr<IWinEventHandler> WndEvtHandler;
REBARBANDINFOW rbi;
HRESULT hRet;
UINT uBand;
LONG NewAllocated;
struct BandObject *NewBand = NULL;
CComPtr<IDeskBand> DeskBand;
CComPtr<IObjectWithSite> ObjWithSite;
CComPtr<IOleWindow> OleWindow;
CComPtr<IWinEventHandler> WndEvtHandler;
REBARBANDINFOW rbi;
HRESULT hRet;
UINT uBand;
TRACE("(%p, %p)\n", this, punk);
if (punk == NULL || fRebarWindow == NULL)
return E_FAIL;
hRet = punk->QueryInterface(IID_IDeskBand, (PVOID *)&DeskBand);
hRet = punk->QueryInterface(IID_IDeskBand, reinterpret_cast<PVOID *>(&DeskBand));
if (!SUCCEEDED(hRet) || DeskBand == NULL)
goto Cleanup;
hRet = punk->QueryInterface(IID_IObjectWithSite, (PVOID *)&ObjWithSite);
hRet = punk->QueryInterface(IID_IObjectWithSite, reinterpret_cast<PVOID *>(&ObjWithSite));
if (!SUCCEEDED(hRet) || ObjWithSite == NULL)
goto Cleanup;
hRet = punk->QueryInterface(IID_IOleWindow, (PVOID *)&OleWindow);
hRet = punk->QueryInterface(IID_IOleWindow, reinterpret_cast<PVOID *>(&OleWindow));
if (!SUCCEEDED(hRet) || OleWindow == NULL)
goto Cleanup;
hRet = punk->QueryInterface(IID_IWinEventHandler, (PVOID *)&WndEvtHandler);
hRet = punk->QueryInterface(IID_IWinEventHandler, reinterpret_cast<PVOID *>(&WndEvtHandler));
if (!SUCCEEDED(hRet) || WndEvtHandler == NULL)
goto Cleanup;
@ -304,7 +302,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
if (fBandsAllocated > fBandsCount)
{
/* Search for a free band object */
for (i = 0; i < fBandsAllocated; i++)
for (INT i = 0; i < fBandsAllocated; i++)
{
if (fBands[i].DeskBand == NULL)
{
@ -377,7 +375,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
NewBand->WndEvtHandler = WndEvtHandler.Detach();
/* Create the ReBar band */
hRet = ObjWithSite->SetSite((IOleWindow *)this);
hRet = ObjWithSite->SetSite(static_cast<IOleWindow *>(this));
if (SUCCEEDED(hRet))
{
uBand = 0xffffffff;
@ -399,7 +397,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
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;
hRet = (HRESULT)((USHORT)GetBandID(NewBand));
@ -433,7 +431,7 @@ Cleanup:
HRESULT STDMETHODCALLTYPE CBandSiteBase::EnumBands(UINT uBand, DWORD *pdwBandID)
{
DWORD i;
DWORD i;
TRACE("(%p, %u, %p)\n", this, uBand, pdwBandID);
@ -460,9 +458,10 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::EnumBands(UINT uBand, DWORD *pdwBandID)
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;
TRACE("(%p, %u, %p, %p, %p, %d)\n", this, dwBandID, ppstb, pdwState, pszName, cchName);
@ -492,7 +491,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryBand(DWORD dwBandID, IDeskBand **p
HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState)
{
struct BandObject *Band;
struct BandObject *Band;
TRACE("(%p, %u, %x, %x)\n", this, dwBandID, dwMask, dwState);
@ -506,8 +505,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandState(DWORD dwBandID, DWORD dwMa
HRESULT STDMETHODCALLTYPE CBandSiteBase::RemoveBand(DWORD dwBandID)
{
struct BandObject *Band;
UINT uBand;
struct BandObject *Band;
UINT uBand;
TRACE("(%p, %u)\n", this, dwBandID);
@ -535,7 +534,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::RemoveBand(DWORD dwBandID)
HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv)
{
struct BandObject *Band;
struct BandObject *Band;
TRACE("(%p, %u, %s, %p)\n", this, dwBandID, debugstr_guid(&riid), ppv);
@ -563,7 +562,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandSiteInfo(BANDSITEINFO *pbsinfo)
HRESULT STDMETHODCALLTYPE CBandSiteBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult)
{
struct BandObject *Band;
struct BandObject *Band;
TRACE("(%p, %p, %u, %p, %p, %p)\n", this, hWnd, uMsg, wParam, lParam, plrResult);
@ -589,7 +588,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
HRESULT STDMETHODCALLTYPE CBandSiteBase::IsWindowOwner(HWND hWnd)
{
struct BandObject *Band;
struct BandObject *Band;
TRACE("(%p, %p)\n", this, hWnd);
@ -622,36 +621,34 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::ContextSensitiveHelp(BOOL fEnterMode)
HRESULT STDMETHODCALLTYPE CBandSiteBase::SetDeskBarSite(IUnknown *pUnk)
{
HWND hWndParent;
HRESULT hRet;
HWND hWndParent;
HRESULT hRet;
DWORD style;
TRACE("(%p, %p)\n", this, pUnk);
fOleWindow.Release();
hRet = pUnk->QueryInterface(IID_IOleWindow, (PVOID *)&fOleWindow);
if (!SUCCEEDED(hRet))
if (FAILED(hRet))
return E_FAIL;
hRet = fOleWindow->GetWindow(&hWndParent);
if (!SUCCEEDED(hRet))
if (FAILED(hRet))
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,
REBARCLASSNAMEW,
NULL,
WS_CHILD | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | RBS_VARHEIGHT |
RBS_BANDBORDERS | CCS_NODIVIDER |
CCS_NORESIZE | CCS_NOPARENTALIGN,
0,
0,
0,
0,
hWndParent,
NULL,
_AtlBaseModule.GetModuleInstance(),
NULL);
REBARCLASSNAMEW,
NULL,
style,
0, 0, 0, 0,
hWndParent,
NULL,
_AtlBaseModule.GetModuleInstance(),
NULL);
if (fRebarWindow == NULL)
{
fOleWindow.Release();
@ -664,8 +661,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::SetDeskBarSite(IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE CBandSiteBase::SetModeDBC(DWORD dwMode)
{
LONG dwStyle;
LONG dwPrevStyle;
LONG dwStyle;
LONG dwPrevStyle;
TRACE("(%p, %x)\n", this, dwMode);
@ -705,15 +702,17 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSize(DWORD unknown1, LPRECT unknown2
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);
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;
TRACE("(%p, %p, %u, %u, %p, %p)\n", this, pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut);
@ -755,80 +754,81 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::Exec(const GUID *pguidCmdGroup, DWORD n
HRESULT STDMETHODCALLTYPE CBandSiteBase::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::HasFocusIO()
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::TranslateAcceleratorIO(LPMSG lpMsg)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::OnFocusChangeIS(struct IUnknown *paramC, int param10)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::GetClassID(CLSID *pClassID)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::IsDirty()
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::Load(IStream *pStm)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::Save(IStream *pStm, BOOL fClearDirty)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
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;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::DragLeave()
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::LoadFromStreamBS(IStream *, const GUID &, void **)
{
return E_NOTIMPL;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CBandSiteBase::SaveToStreamBS(IUnknown *, IStream *)
{
return E_NOTIMPL;
return E_NOTIMPL;
}

View file

@ -121,20 +121,20 @@ private:
HRESULT UpdateBand(DWORD dwBandID);
struct BandObject *GetBandFromHwnd(HWND hwnd);
BEGIN_COM_MAP(CBandSiteBase)
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper)
END_COM_MAP()
BEGIN_COM_MAP(CBandSiteBase)
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper)
END_COM_MAP()
};
class CBandSite :
@ -143,9 +143,8 @@ class CBandSite :
{
public:
DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITE)
DECLARE_NOT_AGGREGATABLE(CBandSite)
DECLARE_PROTECT_FINAL_CONSTRUCT()
DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITE)
DECLARE_NOT_AGGREGATABLE(CBandSite)
DECLARE_PROTECT_FINAL_CONSTRUCT()
};

View file

@ -37,7 +37,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteMenu::SetOwner(IUnknown *pOwner)
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);
return E_NOTIMPL;
@ -49,7 +50,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpi
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);
return E_NOTIMPL;

View file

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

View file

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

View file

@ -83,11 +83,12 @@ private:
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
// *** 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);
// *** IInputObjectSite specific methods ***
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus);
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
// *** IDeskBarClient methods ***
virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite);
@ -96,13 +97,16 @@ private:
virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc);
// *** IOleCommandTarget methods ***
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
// *** IBandSite specific methods ***
virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk);
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 RemoveBand(DWORD dwBandID);
virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, void **ppv);
@ -165,37 +169,44 @@ HRESULT CBaseBarSite::InsertBar(IUnknown *newBar)
DWORD thisBandID;
HRESULT hResult;
hResult = newBar->QueryInterface(IID_IPersist, (void **)&persist);
hResult = newBar->QueryInterface(IID_IPersist, reinterpret_cast<void **>(&persist));
if (FAILED(hResult))
return hResult;
hResult = newBar->QueryInterface(IID_IObjectWithSite, (void **)&site);
hResult = newBar->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&site));
if (FAILED(hResult))
return hResult;
hResult = newBar->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
hResult = newBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult))
return hResult;
hResult = newBar->QueryInterface(IID_IDeskBand, (void **)&deskBand);
hResult = newBar->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(&deskBand));
if (FAILED(hResult))
return hResult;
hResult = newBar->QueryInterface(IID_IDockingWindow, (void **)&dockingWindow);
hResult = newBar->QueryInterface(IID_IDockingWindow, reinterpret_cast<void **>(&dockingWindow));
if (FAILED(hResult))
return hResult;
hResult = site->SetSite((IOleWindow *)this);
hResult = site->SetSite(static_cast<IOleWindow *>(this));
if (FAILED(hResult))
return hResult;
newInfo = new CBarInfo;
ATLTRY(newInfo = new CBarInfo);
if (newInfo == NULL)
return E_OUTOFMEMORY;
// set new bar info
thisBandID = fNextBandID++;
newInfo->fTheBar = newBar;
newInfo->fBandID = thisBandID;
hResult = persist->GetClassID(&newInfo->fBarClass);
// get band info
deskBandInfo.dwMask = DBIM_MINSIZE | DBIM_ACTUAL | DBIM_TITLE;
deskBandInfo.wszTitle[0] = 0;
hResult = deskBand->GetBandInfo(0, 0, &deskBandInfo);
// insert band
memset(&bandInfo, 0, 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.lpText = deskBandInfo.wszTitle;
hResult = oleWindow->GetWindow(&bandInfo.hwndChild);
@ -207,9 +218,11 @@ HRESULT CBaseBarSite::InsertBar(IUnknown *newBar)
bandInfo.cyMaxChild = 32000;
bandInfo.cyIntegral = 1;
bandInfo.cxIdeal = 0; //deskBandInfo.ptActual.x;
bandInfo.lParam = (LPARAM)newInfo;
SendMessage(RB_INSERTBANDW, -1, (LPARAM)&bandInfo);
hResult = dockingWindow->ShowDW(TRUE); // this call is what makes the tree fill with contents
bandInfo.lParam = reinterpret_cast<LPARAM>(newInfo);
SendMessage(RB_INSERTBANDW, -1, reinterpret_cast<LPARAM>(&bandInfo));
// this call is what makes the tree fill with contents
hResult = dockingWindow->ShowDW(TRUE);
if (FAILED(hResult))
return hResult;
// for now
@ -252,7 +265,7 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryService(REFGUID guidService, REFIID
if (fDeskBarSite == NULL)
return E_FAIL;
hResult = fDeskBarSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
hResult = fDeskBarSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED(hResult))
return hResult;
// 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);
}
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<IWinEventHandler> winEventHandler;
@ -275,14 +289,15 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
notifyHeader = (NMHDR *)lParam;
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);
hResult = deskBar->OnPosRectChangeDB(&newBounds);
}
}
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)
hResult = winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
}
@ -309,16 +324,16 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::SetDeskBarSite(IUnknown *punkSite)
fDeskBarSite.Release();
else
{
hResult = punkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
hResult = punkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult))
return hResult;
hResult = punkSite->QueryInterface(IID_IUnknown, (void **)&fDeskBarSite);
hResult = punkSite->QueryInterface(IID_IUnknown, reinterpret_cast<void **>(&fDeskBarSite));
if (FAILED(hResult))
return hResult;
hResult = oleWindow->GetWindow(&ownerWindow);
if (FAILED(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 |
RBS_VARHEIGHT | RBS_REGISTERDROP | RBS_AUTOSIZE | RBS_VERTICALGRIPPER | RBS_DBLCLKTOGGLE |
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;
}
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;
}
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))
{
@ -379,7 +396,8 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::EnumBands(UINT uBand, DWORD *pdwBandID)
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;
}
@ -449,7 +467,7 @@ LRESULT CBaseBarSite::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bH
{
NMHDR *notifyHeader;
notifyHeader = (NMHDR *)lParam;
notifyHeader = reinterpret_cast<NMHDR *>(lParam);
if (notifyHeader->hwndFrom == m_hWnd)
{
}
@ -467,8 +485,8 @@ HRESULT CreateBaseBarSite(REFIID riid, void **ppv)
ATLTRY (theBaseBarSite = new CComObject<CBaseBarSite>);
if (theBaseBarSite == NULL)
return E_OUTOFMEMORY;
hResult = theBaseBarSite->QueryInterface (riid, (void **)ppv);
if (FAILED (hResult))
hResult = theBaseBarSite->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED(hResult))
{
delete theBaseBarSite;
return hResult;

View file

@ -167,30 +167,40 @@ HRESULT STDMETHODCALLTYPE CBrandBand::SetSite(IUnknown* pUnkSite)
// TODO: revoke brand band service
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))
return hResult;
parentWindow = NULL;
hResult = pUnkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (SUCCEEDED(hResult))
hResult = oleWindow->GetWindow(&parentWindow);
if (!::IsWindow(parentWindow))
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)
return E_FAIL;
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))
{
hResult = serviceProvider->QueryService(SID_SBrandBand, IID_IProfferService, (void **)&profferService);
hResult = serviceProvider->QueryService(
SID_SBrandBand, IID_IProfferService, reinterpret_cast<void **>(&profferService));
if (SUCCEEDED(hResult))
hResult = profferService->ProfferService(SID_SBrandBand, (IServiceProvider *)this, &fProfferCookie);
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService, (void **)&browserService);
hResult = profferService->ProfferService(SID_SBrandBand,
static_cast<IServiceProvider *>(this), &fProfferCookie);
hResult = serviceProvider->QueryService(SID_SShellBrowser,
IID_IBrowserService, reinterpret_cast<void **>(&browserService));
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
hResult = S_OK;
SelectImage();
@ -234,7 +244,8 @@ HRESULT STDMETHODCALLTYPE CBrandBand::CloseDW(DWORD dwReserved)
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;
}
@ -296,7 +307,8 @@ HRESULT STDMETHODCALLTYPE CBrandBand::GetSizeMax(ULARGE_INTEGER *pcbSize)
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;
}
@ -308,12 +320,14 @@ HRESULT STDMETHODCALLTYPE CBrandBand::IsWindowOwner(HWND hWnd)
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;
}
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))
{
@ -340,8 +354,8 @@ HRESULT STDMETHODCALLTYPE CBrandBand::QueryService(REFGUID guidService, REFIID r
if (IsEqualIID(guidService, SID_SBrandBand))
return this->QueryInterface(riid, ppvObject);
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
if (FAILED (hResult))
hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED(hResult))
return hResult;
return serviceProvider->QueryService(guidService, riid, ppvObject);
}
@ -356,12 +370,14 @@ HRESULT STDMETHODCALLTYPE CBrandBand::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeI
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;
}
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)
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));
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);
@ -462,8 +478,8 @@ HRESULT CreateBrandBand(REFIID riid, void **ppv)
ATLTRY (theMenuBar = new CComObject<CBrandBand>);
if (theMenuBar == NULL)
return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface (riid, (void **)ppv);
if (FAILED (hResult))
hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED(hResult))
{
delete theMenuBar;
return hResult;

View file

@ -101,29 +101,29 @@ public:
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
BEGIN_MSG_MAP(CBrandBand)
// MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_TIMER, OnTimer)
END_MSG_MAP()
BEGIN_MSG_MAP(CBrandBand)
// MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_TIMER, OnTimer)
END_MSG_MAP()
DECLARE_REGISTRY_RESOURCEID(IDR_BRANDBAND)
DECLARE_NOT_AGGREGATABLE(CBrandBand)
DECLARE_REGISTRY_RESOURCEID(IDR_BRANDBAND)
DECLARE_NOT_AGGREGATABLE(CBrandBand)
DECLARE_PROTECT_FINAL_CONSTRUCT()
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CBrandBand)
COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
END_COM_MAP()
BEGIN_COM_MAP(CBrandBand)
COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
END_COM_MAP()
};

View file

@ -97,7 +97,8 @@ extern "C" long WINAPI IDataObject_GetDeskBandState(long param8)
/*************************************************************************
* 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;
@ -250,7 +251,8 @@ extern "C" HRESULT WINAPI SHEnumClassesOfCategories(long param8, long paramC, lo
/*************************************************************************
* 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;
}

View file

@ -33,12 +33,14 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::QueryService(REFGUID guidService, REFI
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;
}
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;
}
@ -253,7 +255,8 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::ActivatePendingView()
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;
}
@ -363,12 +366,14 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::_SwitchActivationNow()
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;
}
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;
}
@ -468,7 +473,8 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::_CloseAndReleaseToolbars(BOOL fClose)
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;
}
@ -508,7 +514,8 @@ HRESULT STDMETHODCALLTYPE CCommonBrowser::_PositionViewWindow(HWND *, RECT *)
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;
}

View file

@ -186,22 +186,22 @@ public:
virtual HRESULT STDMETHODCALLTYPE DragLeave();
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)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService)
COM_INTERFACE_ENTRY_IID(IID_IBrowserService2, IBrowserService2)
COM_INTERFACE_ENTRY_IID(IID_IBrowserService3, IBrowserService3)
COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
COM_INTERFACE_ENTRY_IID(IID_IShellBrowserService, IShellBrowserService)
COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDockingWindowSite)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindowFrame, IDockingWindowFrame)
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
END_COM_MAP()
BEGIN_COM_MAP(CCommonBrowser)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService)
COM_INTERFACE_ENTRY_IID(IID_IBrowserService2, IBrowserService2)
COM_INTERFACE_ENTRY_IID(IID_IBrowserService3, IBrowserService3)
COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
COM_INTERFACE_ENTRY_IID(IID_IShellBrowserService, IShellBrowserService)
COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDockingWindowSite)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindowFrame, IDockingWindowFrame)
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
END_COM_MAP()
};

View file

@ -33,7 +33,8 @@ HRESULT STDMETHODCALLTYPE CGlobalFolderSettings::Get(DEFFOLDERSETTINGS *paramC,
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;
}

View file

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

View file

@ -115,8 +115,10 @@ private:
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
// *** IOleCommandTarget specific methods ***
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
// *** IServiceProvider methods ***
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
@ -154,13 +156,13 @@ HRESULT CDockSite::Initialize(IUnknown *containedBand, CInternetToolbar *browser
REBARBANDINFOW bandInfo;
HRESULT hResult;
hResult = containedBand->QueryInterface(IID_IObjectWithSite, (void **)&site);
hResult = containedBand->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&site));
if (FAILED(hResult))
return hResult;
hResult = containedBand->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
hResult = containedBand->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult))
return hResult;
hResult = containedBand->QueryInterface(IID_IDeskBand, (void **)&deskBand);
hResult = containedBand->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(&deskBand));
if (FAILED(hResult))
return hResult;
fContainedBand = containedBand;
@ -168,7 +170,7 @@ HRESULT CDockSite::Initialize(IUnknown *containedBand, CInternetToolbar *browser
fRebarWindow = hwnd;
fBandID = bandID;
fFlags = flags;
hResult = site->SetSite((IOleWindow *)this);
hResult = site->SetSite(static_cast<IOleWindow *>(this));
if (FAILED(hResult))
return hResult;
hResult = oleWindow->GetWindow(&fChildWindow);
@ -192,15 +194,17 @@ HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
CComPtr<IDeskBand> deskBand;
HRESULT hResult;
hResult = fContainedBand->QueryInterface(IID_IDeskBand, (void **)&deskBand);
hResult = fContainedBand->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(&deskBand));
if (FAILED(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);
// 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;
if (fDeskBandInfo.dwModeFlags & DBIMF_VARIABLEHEIGHT)
@ -211,11 +215,11 @@ HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
bandInfo.fStyle |= RBBS_BREAK;
if (fDeskBandInfo.dwModeFlags & DBIMF_TOPALIGN)
bandInfo.fStyle |= RBBS_TOPALIGN;
if (fFlags & ITF_NOGRIPPER || fToolbar->fLocked == true)
if (fFlags & ITF_NOGRIPPER || fToolbar->fLocked)
bandInfo.fStyle |= RBBS_NOGRIPPER;
if (fFlags & ITF_NOTITLE)
bandInfo.fStyle |= RBBS_HIDETITLE;
if (fFlags & ITF_GRIPPERALWAYS && fToolbar->fLocked == false)
if (fFlags & ITF_GRIPPERALWAYS && !fToolbar->fLocked)
bandInfo.fStyle |= RBBS_GRIPPERALWAYS;
if (fFlags & ITF_FIXEDSIZE)
bandInfo.fStyle |= RBBS_FIXEDSIZE;
@ -235,7 +239,7 @@ HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
bandInfo.cyMaxChild = fDeskBandInfo.ptMaxSize.y;
bandInfo.cyIntegral = fDeskBandInfo.ptIntegral.y;
bandInfo.cxIdeal = fDeskBandInfo.ptActual.x;
bandInfo.lParam = (LPARAM)this;
bandInfo.lParam = reinterpret_cast<LPARAM>(this);
return S_OK;
}
@ -272,12 +276,14 @@ HRESULT STDMETHODCALLTYPE CDockSite::OnFocusChangeIS (IUnknown *punkObj, BOOL fS
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;
}
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];
REBARBANDINFOW bandInfo;
@ -319,8 +325,8 @@ HRESULT STDMETHODCALLTYPE CDockSite::QueryService(REFGUID guidService, REFIID ri
if (IsEqualIID(guidService, SID_SMenuBandParent))
return this->QueryInterface(riid, ppvObject);
hResult = fToolbar->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
if (FAILED (hResult))
hResult = fToolbar->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED(hResult))
return hResult;
return serviceProvider->QueryService(guidService, riid, ppvObject);
}
@ -345,14 +351,18 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
HKEY orderRegKey;
DWORD disposition;
HRESULT hResult;
static const TCHAR szFavoritesKey[] =
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Favorites");
if (!IsEqualIID(riid, IID_IShellMenu))
return E_FAIL;
if (psmd->uId != FCIDM_MENU_FAVORITES)
return E_FAIL;
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))
return hResult;
hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL);
@ -361,7 +371,8 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
favoritesHMenu = GetSubMenu(parentHMenu, 3);
if (favoritesHMenu == NULL)
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))
return hResult;
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);
if (FAILED(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);
hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | 0x18);
ILFree(favoritesPIDL);
@ -399,8 +410,8 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::CallbackSM(LPSMDATA psmd, UINT uMsg, WP
case SMC_EXITMENU:
break;
case SMC_GETINFO:
{
SMINFO *infoPtr = (SMINFO *)lParam;
{
SMINFO *infoPtr = reinterpret_cast<SMINFO *>(lParam);
if ((infoPtr->dwMask & SMIM_FLAGS) != 0)
{
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)
infoPtr->iIcon = -1;
}
return S_OK;
}
case SMC_GETSFINFO:
break;
case SMC_GETOBJECT:
return GetObject(psmd, *(IID *)wParam, (void **)lParam);
return GetObject(psmd, *reinterpret_cast<IID *>(wParam), reinterpret_cast<void **>(lParam));
case SMC_GETSFOBJECT:
break;
case SMC_SFEXEC:
@ -495,20 +506,20 @@ HRESULT CInternetToolbar::ReserveBorderSpace()
RECT neededBorderSpace;
HRESULT hResult;
hResult = fSite->QueryInterface(IID_IDockingWindowSite, (void **)&dockingWindowSite);
hResult = fSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&dockingWindowSite));
if (FAILED(hResult))
return hResult;
hResult = dockingWindowSite->GetBorderDW((IDockingWindow *)this, &availableBorderSpace);
hResult = dockingWindowSite->GetBorderDW(static_cast<IDockingWindow *>(this), &availableBorderSpace);
if (FAILED(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.top = availableBorderSpace.bottom - availableBorderSpace.top;
if (fLocked == false)
if (!fLocked)
neededBorderSpace.top += 3;
neededBorderSpace.right = 0;
neededBorderSpace.bottom = 0;
hResult = dockingWindowSite->SetBorderSpaceDW((IDockingWindow *)this, &neededBorderSpace);
hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
if (FAILED(hResult))
return hResult;
return S_OK;
@ -524,22 +535,23 @@ HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **menuBar)
HWND ownerWindow;
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))
return hResult;
hResult = fMenuCallback.QueryInterface(IID_IShellMenuCallback, (void **)&callback);
hResult = fMenuCallback.QueryInterface(IID_IShellMenuCallback, reinterpret_cast<void **>(&callback));
if (FAILED(hResult))
return hResult;
hResult = (*menuBar)->Initialize(callback, -1, ANCESTORDEFAULT, SMINIT_HORIZONTAL | SMINIT_TOPLEVEL);
if (FAILED(hResult))
return hResult;
hResult = fSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
hResult = fSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (FAILED(hResult))
return hResult;
hResult = oleWindow->GetWindow(&ownerWindow);
if (FAILED(hResult))
return hResult;
hResult = fSite->QueryInterface(IID_IOleCommandTarget, (void **)&siteCommandTarget);
hResult = fSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&siteCommandTarget));
if (FAILED(hResult))
return hResult;
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);
if (FAILED(hResult))
return hResult;
hResult = (*menuBar)->QueryInterface(IID_IOleCommandTarget, (void **)&commandTarget);
hResult = (*menuBar)->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
if (FAILED(hResult))
return hResult;
hResult = commandTarget->Exec(&CGID_MenuBand, 3, 1, NULL, NULL);
@ -565,9 +577,10 @@ HRESULT CInternetToolbar::CreateBrandBand(IUnknown **logoBar)
HRESULT hResult;
#if 1
hResult = ::CreateBrandBand(IID_IUnknown, (void **)logoBar);
hResult = ::CreateBrandBand(IID_IUnknown, reinterpret_cast<void **>(logoBar));
#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
if (FAILED(hResult))
return hResult;
@ -578,7 +591,7 @@ HRESULT CInternetToolbar::CreateToolsBar(IUnknown **toolsBar)
{
HRESULT hResult;
hResult = ::CreateToolsBar(IID_IUnknown, (void **)toolsBar);
hResult = ::CreateToolsBar(IID_IUnknown, reinterpret_cast<void **>(toolsBar));
if (FAILED(hResult))
return hResult;
return S_OK;
@ -590,13 +603,14 @@ HRESULT CInternetToolbar::CreateAddressBand(IUnknown **toolsBar)
HRESULT hResult;
#if 1
hResult = ::CreateAddressBand(IID_IUnknown, (void **)toolsBar);
hResult = ::CreateAddressBand(IID_IUnknown, reinterpret_cast<void **>(toolsBar));
#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
if (FAILED(hResult))
return hResult;
hResult = (*toolsBar)->QueryInterface(IID_IAddressBand, (void **)&addressBand);
hResult = (*toolsBar)->QueryInterface(IID_IAddressBand, reinterpret_cast<void **>(&addressBand));
return S_OK;
}
@ -604,7 +618,6 @@ HRESULT CInternetToolbar::LockUnlockToolbars(bool locked)
{
REBARBANDINFOW rebarBandInfo;
int bandCount;
int x;
CDockSite *dockSite;
HRESULT hResult;
@ -614,16 +627,16 @@ HRESULT CInternetToolbar::LockUnlockToolbars(bool locked)
rebarBandInfo.cbSize = sizeof(rebarBandInfo);
rebarBandInfo.fMask = RBBIM_STYLE | RBBIM_LPARAM;
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);
dockSite = (CDockSite *)rebarBandInfo.lParam;
dockSite = reinterpret_cast<CDockSite *>(rebarBandInfo.lParam);
if (dockSite != NULL)
{
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;
if (dockSite->fFlags & CDockSite::ITF_GRIPPERALWAYS && fLocked == false)
if (dockSite->fFlags & CDockSite::ITF_GRIPPERALWAYS && !fLocked)
rebarBandInfo.fStyle |= RBBS_GRIPPERALWAYS;
SendMessage(fMainReBar, RB_SETBANDINFOW, x, (LPARAM)&rebarBandInfo);
}
@ -664,17 +677,17 @@ HRESULT CInternetToolbar::CreateAndInitBandProxy()
CComPtr<IServiceProvider> serviceProvider;
HRESULT hResult;
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
if (FAILED (hResult))
hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED(hResult))
return hResult;
hResult = serviceProvider->QueryService(SID_IBandProxy, IID_IBandProxy, (void **)&fBandProxy);
if (FAILED (hResult))
hResult = serviceProvider->QueryService(SID_IBandProxy, IID_IBandProxy, reinterpret_cast<void **>(&fBandProxy));
if (FAILED(hResult))
{
hResult = CreateBandProxy(IID_IBandProxy, (void **)&fBandProxy);
if (FAILED (hResult))
hResult = CreateBandProxy(IID_IBandProxy, reinterpret_cast<void **>(&fBandProxy));
if (FAILED(hResult))
return hResult;
hResult = fBandProxy->SetSite(fSite);
if (FAILED (hResult))
if (FAILED(hResult))
return hResult;
}
return S_OK;
@ -715,7 +728,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::ShowDW(BOOL fShow)
// show the bar here
hResult = ReserveBorderSpace();
hResult = fMenuBar->QueryInterface(IID_IDockingWindow, (void **)&dockingWindow);
hResult = fMenuBar->QueryInterface(IID_IDockingWindow, reinterpret_cast<void **>(&dockingWindow));
hResult = dockingWindow->ShowDW(fShow);
return S_OK;
}
@ -725,7 +738,8 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::CloseDW(DWORD dwReserved)
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;
}
@ -772,15 +786,18 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
hResult = CreateMenuBar(&menuBar);
if (FAILED(hResult))
return hResult;
AddDockItem(menuBar, ITBBID_MENUBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
hResult = menuBar->QueryInterface(IID_IOleWindow, (void **)&menuOleWindow);
AddDockItem(menuBar, ITBBID_MENUBAND,
CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
hResult = menuBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&menuOleWindow));
hResult = menuOleWindow->GetWindow(&fMenuBandWindow);
fMenuBar.Attach(menuBar.Detach()); // transfer the ref count
hResult = CreateBrandBand(&logoBar);
if (FAILED(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
hResult = CreateToolsBar(&toolsBar);
@ -788,7 +805,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
return hResult;
AddDockItem(toolsBar, ITBBID_TOOLSBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS);
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))
return hResult;
hResult = toolbarOleWindow->GetWindow(&fToolbarWindow);
@ -799,14 +816,15 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
if (FAILED(hResult))
return hResult;
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);
fNavigationBar.Attach(navigationBar.Detach());
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))
{
@ -852,7 +870,8 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryStatus(const GUID *pguidCmdGrou
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))
{
@ -893,12 +912,14 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::GetTypeInfo(UINT iTInfo, LCID lcid,
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;
}
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;
@ -915,8 +936,8 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::Invoke(DISPID dispIdMember, REFIID r
return E_INVALIDARG;
if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL || V_VT(&pDispParams->rgvarg[1]) != VT_I4)
return E_INVALIDARG;
return CommandStateChanged(V_BOOL(&pDispParams->rgvarg[0]) == VARIANT_FALSE ? false : true,
V_I4(&pDispParams->rgvarg[1]));
return CommandStateChanged(V_BOOL(&pDispParams->rgvarg[0]) != VARIANT_FALSE,
V_I4(&pDispParams->rgvarg[1]));
case DISPID_DOWNLOADBEGIN:
hResult = S_OK;
break;
@ -935,7 +956,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetCommandTarget(IUnknown *theTarget
HRESULT hResult;
fCommandTarget.Release();
hResult = theTarget->QueryInterface(IID_IOleCommandTarget, (void **)&fCommandTarget);
hResult = theTarget->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&fCommandTarget));
if (FAILED(hResult))
return hResult;
fCommandCategory = *category;
@ -952,11 +973,13 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::AddButtons(const GUID *pguidCmdGroup
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;
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;
if (result == -1)
return E_FAIL;
@ -984,7 +1007,8 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetState(const GUID *pguidCmdGroup,
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;
}
@ -997,12 +1021,14 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::GetBitmapSize(long *paramC)
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;
}
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;
}
@ -1025,6 +1051,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
HWND ownerWindow;
HWND dockContainer;
HRESULT hResult;
DWORD style;
if (pUnkSite == NULL)
{
@ -1035,7 +1062,8 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
}
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))
return hResult;
hResult = oleWindow->GetWindow(&ownerWindow);
@ -1043,19 +1071,28 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
return hResult;
if (ownerWindow == NULL)
return E_FAIL;
// create dock container
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)
return E_FAIL;
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);
if (fMainReBar == NULL)
return E_FAIL;
hResult = pUnkSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService, (void **)&browserService);
hResult = AtlAdvise(browserService, (IDispatch *)this, DIID_DWebBrowserEvents, &fAdviseCookie);
// take advice to watch events
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;
}
@ -1082,25 +1119,26 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryService(REFGUID guidService, RE
if (fBandProxy.p == NULL)
{
hResult = CreateAndInitBandProxy();
if (FAILED (hResult))
if (FAILED(hResult))
return hResult;
}
return fBandProxy->QueryInterface(riid, ppvObject);
}
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
if (FAILED (hResult))
hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED(hResult))
return hResult;
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;
HRESULT hResult;
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 E_FAIL;
@ -1121,14 +1159,15 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::EnumBands(UINT uBand, DWORD *pdwBand
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)
return E_POINTER;
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)
return fLogoBar->QueryInterface(IID_IDeskBand, (void **)ppstb);
return fLogoBar->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(ppstb));
*ppstb = NULL;
return E_FAIL;
}
@ -1164,11 +1203,12 @@ LRESULT CInternetToolbar::OnTravelBack(WORD wNotifyCode, WORD wID, HWND hWndCtl,
CComPtr<IWebBrowser> webBrowser;
HRESULT hResult;
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
if (FAILED (hResult))
hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED(hResult))
return 0;
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IWebBrowser, (void **)&webBrowser);
if (FAILED (hResult))
hResult = serviceProvider->QueryService(SID_SShellBrowser,
IID_IWebBrowser, reinterpret_cast<void **>(&webBrowser));
if (FAILED(hResult))
return 0;
hResult = webBrowser->GoBack();
return 1;
@ -1180,11 +1220,12 @@ LRESULT CInternetToolbar::OnTravelForward(WORD wNotifyCode, WORD wID, HWND hWndC
CComPtr<IWebBrowser> webBrowser;
HRESULT hResult;
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
if (FAILED (hResult))
hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
if (FAILED(hResult))
return 0;
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IWebBrowser, (void **)&webBrowser);
if (FAILED (hResult))
hResult = serviceProvider->QueryService(
SID_SShellBrowser, IID_IWebBrowser, reinterpret_cast<void **>(&webBrowser));
if (FAILED(hResult))
return 0;
hResult = webBrowser->GoForward();
return 1;
@ -1195,8 +1236,8 @@ LRESULT CInternetToolbar::OnUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
CComPtr<IOleCommandTarget> oleCommandTarget;
HRESULT hResult;
hResult = fSite->QueryInterface(IID_IOleCommandTarget, (void **)&oleCommandTarget);
if (FAILED (hResult))
hResult = fSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
if (FAILED(hResult))
return hResult;
hResult = oleCommandTarget->Exec(&CGID_ShellBrowser, IDM_GOTO_UPONELEVEL, 0, NULL, NULL);
return 1;
@ -1218,14 +1259,15 @@ LRESULT CInternetToolbar::OnSearch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
commandInfo.lpParameters = searchGUID;
commandInfo.nShow = SW_SHOWNORMAL;
hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER, IID_IContextMenu, (void **)&contextMenu);
if (FAILED (hResult))
hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
IID_IContextMenu, reinterpret_cast<void **>(&contextMenu));
if (FAILED(hResult))
return 0;
hResult = contextMenu->QueryInterface(IID_IObjectWithSite, (void **)&objectWithSite);
if (FAILED (hResult))
hResult = contextMenu->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&objectWithSite));
if (FAILED(hResult))
return 0;
hResult = objectWithSite->SetSite(fSite);
if (FAILED (hResult))
if (FAILED(hResult))
return 0;
hResult = contextMenu->InvokeCommand(&commandInfo);
hResult = objectWithSite->SetSite(NULL);
@ -1237,8 +1279,8 @@ LRESULT CInternetToolbar::OnFolders(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
CComPtr<IOleCommandTarget> oleCommandTarget;
HRESULT hResult;
hResult = fSite->QueryInterface(IID_IOleCommandTarget, (void **)&oleCommandTarget);
if (FAILED (hResult))
hResult = fSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
if (FAILED(hResult))
return hResult;
hResult = oleCommandTarget->Exec(&CGID_Explorer, 0x23, 0, NULL, NULL);
return 1;
@ -1277,20 +1319,22 @@ LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bH
bHandled = FALSE;
return 0;
}
SendMessage(fToolbarWindow, TB_GETRECT, notifyInfo->iItem, (LPARAM)&bounds);
::MapWindowPoints(fToolbarWindow, NULL, (POINT *)&bounds, 2);
SendMessage(fToolbarWindow, TB_GETRECT, notifyInfo->iItem, reinterpret_cast<LPARAM>(&bounds));
::MapWindowPoints(fToolbarWindow, NULL, reinterpret_cast<POINT *>(&bounds), 2);
switch (notifyInfo->iItem)
{
case gBackCommandID:
newMenu = CreatePopupMenu();
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService, (void **)&browserService);
hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
hResult = serviceProvider->QueryService(
SID_SShellBrowser, IID_IBrowserService, reinterpret_cast<void **>(&browserService));
hResult = browserService->GetTravelLog(&travelLog);
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;
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_STRING /* | MF_OWNERDRAW */, IDM_EXPLORERBAR_HISTORY, L"&History\tCtrl+H");
@ -1311,14 +1355,16 @@ LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bH
break;
case gForwardCommandID:
newMenu = CreatePopupMenu();
hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService, (void **)&browserService);
hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService,
reinterpret_cast<void **>(&browserService));
hResult = browserService->GetTravelLog(&travelLog);
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;
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_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;
V_VT(&inValue) = VT_INT_PTR;
V_INTREF(&inValue) = (INT *)&bounds;
V_INTREF(&inValue) = reinterpret_cast<INT *>(&bounds);
if (fCommandTarget.p != NULL)
hResult = fCommandTarget->Exec(&fCommandCategory, 0x7031, 1, &inValue, &outValue);
@ -1369,7 +1415,7 @@ LRESULT CInternetToolbar::OnNavigateCommand(UINT uMsg, WPARAM wParam, LPARAM lPa
LRESULT theResult;
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);
if (SUCCEEDED(hResult))
return theResult;
@ -1448,7 +1494,8 @@ LRESULT CInternetToolbar::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &
{
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;
}
@ -1473,7 +1520,7 @@ LRESULT CInternetToolbar::OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandle
wchar_t tempString[300];
HRESULT hResult;
pTTTW = (TOOLTIPTEXTW *)pNMHDR;
pTTTW = reinterpret_cast<TOOLTIPTEXTW *>(pNMHDR);
if ((pTTTW->uFlags & TTF_IDISHWND) != 0)
nID = ::GetDlgCtrlID((HWND)pNMHDR->idFrom);
else
@ -1484,10 +1531,11 @@ LRESULT CInternetToolbar::OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandle
if (nID == (UINT)gBackCommandID || nID == (UINT)gForwardCommandID)
{
// 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 = travelLog->GetToolTipText(browserService, nID == (UINT)gBackCommandID ? TLOG_BACK : TLOG_FORE,
0, tempString, 299);
hResult = travelLog->GetToolTipText(browserService,
(nID == (UINT)gBackCommandID) ? TLOG_BACK : TLOG_FORE,
0, tempString, 299);
if (FAILED(hResult))
{
bHandled = FALSE;
@ -1497,7 +1545,8 @@ LRESULT CInternetToolbar::OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandle
else
tempString[0] = 0;
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;
@ -1513,13 +1562,14 @@ LRESULT CInternetToolbar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
notifyHeader = (NMHDR *)lParam;
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);
return theResult;
}
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);
return theResult;
}
@ -1537,8 +1587,8 @@ HRESULT CreateInternetToolbar(REFIID riid, void **ppv)
ATLTRY (theToolbar = new CComObject<CInternetToolbar>);
if (theToolbar == NULL)
return E_OUTOFMEMORY;
hResult = theToolbar->QueryInterface (riid, (void **)ppv);
if (FAILED (hResult))
hResult = theToolbar->QueryInterface (riid, reinterpret_cast<void **>(ppv));
if (FAILED(hResult))
{
delete theToolbar;
return hResult;

View file

@ -198,43 +198,43 @@ public:
LRESULT OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled);
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
BEGIN_MSG_MAP(CInternetToolbar)
COMMAND_ID_HANDLER(gBackCommandID, OnTravelBack)
COMMAND_ID_HANDLER(gForwardCommandID, OnTravelForward)
COMMAND_ID_HANDLER(gUpLevelCommandID, OnUpLevel)
COMMAND_ID_HANDLER(gSearchCommandID, OnSearch)
COMMAND_ID_HANDLER(gFoldersCommandID, OnFolders)
COMMAND_RANGE_HANDLER(0x7000, 0x7fff, OnForwardToCommandTarget)
NOTIFY_HANDLER(0, TBN_DROPDOWN, OnMenuDropDown)
NOTIFY_HANDLER(0, TBN_QUERYINSERT, OnQueryInsert)
NOTIFY_HANDLER(0, TBN_QUERYDELETE, OnQueryDelete)
MESSAGE_HANDLER(WM_COMMAND, OnNavigateCommand)
MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
END_MSG_MAP()
BEGIN_MSG_MAP(CInternetToolbar)
COMMAND_ID_HANDLER(gBackCommandID, OnTravelBack)
COMMAND_ID_HANDLER(gForwardCommandID, OnTravelForward)
COMMAND_ID_HANDLER(gUpLevelCommandID, OnUpLevel)
COMMAND_ID_HANDLER(gSearchCommandID, OnSearch)
COMMAND_ID_HANDLER(gFoldersCommandID, OnFolders)
COMMAND_RANGE_HANDLER(0x7000, 0x7fff, OnForwardToCommandTarget)
NOTIFY_HANDLER(0, TBN_DROPDOWN, OnMenuDropDown)
NOTIFY_HANDLER(0, TBN_QUERYINSERT, OnQueryInsert)
NOTIFY_HANDLER(0, TBN_QUERYDELETE, OnQueryDelete)
MESSAGE_HANDLER(WM_COMMAND, OnNavigateCommand)
MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
END_MSG_MAP()
DECLARE_REGISTRY_RESOURCEID(IDR_INTERNETTOOLBAR)
DECLARE_NOT_AGGREGATABLE(CInternetToolbar)
DECLARE_REGISTRY_RESOURCEID(IDR_INTERNETTOOLBAR)
DECLARE_NOT_AGGREGATABLE(CInternetToolbar)
DECLARE_PROTECT_FINAL_CONSTRUCT()
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CInternetToolbar)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
// COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
COM_INTERFACE_ENTRY_IID(IID_IPersistStreamInit, IPersistStreamInit)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
COM_INTERFACE_ENTRY_IID(IID_IExplorerToolbar, IExplorerToolbar)
COM_INTERFACE_ENTRY_IID(IID_IShellChangeNotify, IShellChangeNotify)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
END_COM_MAP()
BEGIN_COM_MAP(CInternetToolbar)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
// COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
COM_INTERFACE_ENTRY_IID(IID_IPersistStreamInit, IPersistStreamInit)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
COM_INTERFACE_ENTRY_IID(IID_IExplorerToolbar, IExplorerToolbar)
COM_INTERFACE_ENTRY_IID(IID_IShellChangeNotify, IShellChangeNotify)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
END_COM_MAP()
};

View file

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

View file

@ -41,13 +41,13 @@ public:
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
DECLARE_REGISTRY_RESOURCEID(IDR_REGTREEOPTIONS)
DECLARE_NOT_AGGREGATABLE(CRegTreeOptions)
DECLARE_REGISTRY_RESOURCEID(IDR_REGTREEOPTIONS)
DECLARE_NOT_AGGREGATABLE(CRegTreeOptions)
DECLARE_PROTECT_FINAL_CONSTRUCT()
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CRegTreeOptions)
COM_INTERFACE_ENTRY_IID(IID_IRegTreeOptions, IRegTreeOptions)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
END_COM_MAP()
BEGIN_COM_MAP(CRegTreeOptions)
COM_INTERFACE_ENTRY_IID(IID_IRegTreeOptions, IRegTreeOptions)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
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();
if (pUnkSite == NULL)
return S_OK;
hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, (void **)&fDockSite);
hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&fDockSite));
if (FAILED(hResult))
return hResult;
parentWindow = NULL;
hResult = pUnkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
if (SUCCEEDED(hResult))
{
oleWindow->GetWindow(&parentWindow);
@ -241,7 +241,7 @@ HRESULT STDMETHODCALLTYPE CToolsBand::SetSite(IUnknown* pUnkSite)
if (!::IsWindow(parentWindow))
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 |
CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_TOP, 0, 0, 500, 20, parentWindow, NULL,
_AtlBaseModule.GetModuleInstance(), 0);
@ -252,10 +252,13 @@ HRESULT STDMETHODCALLTYPE CToolsBand::SetSite(IUnknown* pUnkSite)
SendMessage(WM_USER + 100, GetSystemMetrics(SM_CXEDGE) / 2, 0);
SendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 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"));
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;
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)
{
TBNOTIFYW *pTBntf = (TBNOTIFYW *)pNMHDR;
TBNOTIFYW *pTBntf = reinterpret_cast<TBNOTIFYW *>(pNMHDR);
if (pTBntf->iItem >= 0 && pTBntf->iItem < (numShownButtons + numHiddenButtons))
{
@ -386,8 +389,8 @@ HRESULT CreateToolsBar(REFIID riid, void **ppv)
ATLTRY (theMenuBar = new CComObject<CToolsBand>);
if (theMenuBar == NULL)
return E_OUTOFMEMORY;
hResult = theMenuBar->QueryInterface (riid, (void **)ppv);
if (FAILED (hResult))
hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED(hResult))
{
delete theMenuBar;
return hResult;

View file

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