mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 19:01:48 +00:00
[RSHELL]
* Code cleanups and formatting. * Remove the logging wrappers. If I need them again I'll bring them back. * Try to fix a few "glitches" in the hot-tracking. svn path=/branches/shell-experiments/; revision=62693
This commit is contained in:
parent
c21f759be0
commit
9b472f38cb
11 changed files with 95 additions and 2035 deletions
|
@ -16,11 +16,6 @@ list(APPEND SOURCE
|
|||
CMergedFolder.cpp
|
||||
CStartMenu.cpp
|
||||
misc.cpp
|
||||
wraplog.cpp
|
||||
logging/CMenuBandWrap.cpp
|
||||
logging/CMenuDeskBarWrap.cpp
|
||||
logging/CMenuSiteWrap.cpp
|
||||
logging/CStartMenuSiteWrap.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rshell.def)
|
||||
|
||||
add_library(rshell SHARED ${SOURCE})
|
||||
|
|
|
@ -30,7 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(CMenuBand);
|
|||
|
||||
#undef UNIMPLEMENTED
|
||||
|
||||
#define UNIMPLEMENTED DbgPrint("%s is UNIMPLEMENTED!\n", __FUNCTION__)
|
||||
#define UNIMPLEMENTED TRACE("%s is UNIMPLEMENTED!\n", __FUNCTION__)
|
||||
|
||||
extern "C"
|
||||
HRESULT WINAPI CMenuBand_Constructor(REFIID riid, LPVOID *ppv)
|
||||
|
@ -130,7 +130,7 @@ HRESULT STDMETHODCALLTYPE CMenuBand::SetMenu(
|
|||
HWND hwnd,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
DbgPrint("CMenuBand::SetMenu called, hmenu=%p; hwnd=%p, flags=%x\n", hmenu, hwnd, dwFlags);
|
||||
TRACE("CMenuBand::SetMenu called, hmenu=%p; hwnd=%p, flags=%x\n", hmenu, hwnd, dwFlags);
|
||||
|
||||
BOOL created = FALSE;
|
||||
|
||||
|
@ -752,7 +752,7 @@ HRESULT CMenuBand::_ChangeHotItem(CMenuToolbarBase * tb, INT id, DWORD dwFlags)
|
|||
if (m_hotBar == tb && m_hotItem == id)
|
||||
return S_FALSE;
|
||||
|
||||
DbgPrint("Hot item changed from %p %p, to %p %p\n", m_hotBar, m_hotItem, tb, id);
|
||||
TRACE("Hot item changed from %p %p, to %p %p\n", m_hotBar, m_hotItem, tb, id);
|
||||
|
||||
_KillPopupTimers();
|
||||
|
||||
|
@ -769,7 +769,7 @@ HRESULT CMenuBand::_ChangeHotItem(CMenuToolbarBase * tb, INT id, DWORD dwFlags)
|
|||
|
||||
HRESULT CMenuBand::_ChangePopupItem(CMenuToolbarBase * tb, INT id)
|
||||
{
|
||||
DbgPrint("Popup item changed from %p %p, to %p %p\n", m_popupBar, m_popupItem, tb, id);
|
||||
TRACE("Popup item changed from %p %p, to %p %p\n", m_popupBar, m_popupItem, tb, id);
|
||||
|
||||
m_popupBar = tb;
|
||||
m_popupItem = id;
|
||||
|
@ -818,7 +818,6 @@ HRESULT CMenuBand::_MenuItemHotTrack(DWORD changeType)
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
if (m_dwFlags & SMINIT_VERTICAL)
|
||||
{
|
||||
switch (changeType)
|
||||
|
@ -839,7 +838,7 @@ HRESULT CMenuBand::_MenuItemHotTrack(DWORD changeType)
|
|||
else
|
||||
{
|
||||
// In horizontal menubars, left/right are equivalent to vertical's up/down
|
||||
switch(changeType)
|
||||
switch (changeType)
|
||||
{
|
||||
case VK_LEFT:
|
||||
hr = _KeyboardItemChange(VK_UP);
|
||||
|
@ -878,8 +877,6 @@ HRESULT CMenuBand::_MenuItemHotTrack(DWORD changeType)
|
|||
return S_OK;
|
||||
return m_subMenuParent->OnSelect(changeType);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMenuBand::_CancelCurrentPopup()
|
||||
|
@ -909,11 +906,6 @@ HRESULT CMenuBand::_OnPopupSubMenu(IShellMenu * childShellMenu, POINTL * pAt, RE
|
|||
#endif
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUSITE
|
||||
hr = CMenuSite_Wrapper(pBandSite, IID_PPV_ARG(IBandSite, &pBandSite));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
#if USE_SYSTEM_MENUDESKBAR
|
||||
hr = CoCreateInstance(CLSID_MenuDeskBar,
|
||||
|
@ -925,11 +917,6 @@ HRESULT CMenuBand::_OnPopupSubMenu(IShellMenu * childShellMenu, POINTL * pAt, RE
|
|||
#endif
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUDESKBAR
|
||||
hr = CMenuDeskBar_Wrapper(pDeskBar, IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
hr = pDeskBar->SetClient(pBandSite);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
|
@ -946,7 +933,7 @@ HRESULT CMenuBand::_OnPopupSubMenu(IShellMenu * childShellMenu, POINTL * pAt, RE
|
|||
return hr;
|
||||
|
||||
m_subMenuChild = popup;
|
||||
|
||||
|
||||
if (m_subMenuParent)
|
||||
IUnknown_SetSite(popup, m_subMenuParent);
|
||||
else
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
#include "CMenuToolbars.h"
|
||||
#include "CMenuBand.h"
|
||||
|
||||
#undef _ASSERT
|
||||
#define _ASSERT(x) DbgAssert(!!(x), __FILE__, __LINE__, #x)
|
||||
#if DBG
|
||||
# undef _ASSERT
|
||||
# define _ASSERT(x) DbgAssert(!!(x), __FILE__, __LINE__, #x)
|
||||
|
||||
bool DbgAssert(bool x, const char * filename, int line, const char * expr)
|
||||
{
|
||||
|
@ -55,6 +56,10 @@ bool DbgAssert(bool x, const char * filename, int line, const char * expr)
|
|||
}
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
# undef _ASSERT
|
||||
# define _ASSERT(x) (!!(x))
|
||||
#endif
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(CMenuFocus);
|
||||
|
||||
|
@ -192,10 +197,6 @@ void CMenuFocusManager::DisableMouseTrack(HWND parent, BOOL disableThis)
|
|||
entry.mb->_DisableMouseTrack(bDisable);
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// continue;
|
||||
//}
|
||||
}
|
||||
m_mouseTrackDisabled = lastDisable;
|
||||
}
|
||||
|
@ -208,13 +209,13 @@ void CMenuFocusManager::SetCapture(HWND child)
|
|||
{
|
||||
::SetCapture(child);
|
||||
m_captureHwnd = child;
|
||||
DbgPrint("MouseTrack is now capturing %p\n", child);
|
||||
TRACE("MouseTrack is now capturing %p\n", child);
|
||||
}
|
||||
else
|
||||
{
|
||||
::ReleaseCapture();
|
||||
m_captureHwnd = NULL;
|
||||
DbgPrint("MouseTrack is now off\n");
|
||||
TRACE("MouseTrack is now off\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -249,7 +250,7 @@ HRESULT CMenuFocusManager::IsTrackedWindow(HWND hWnd, StackEntry ** pentry)
|
|||
LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
||||
{
|
||||
HWND child;
|
||||
int iHitTestResult;
|
||||
int iHitTestResult = -1;
|
||||
|
||||
POINT pt2 = { GET_X_LPARAM(msg->lParam), GET_Y_LPARAM(msg->lParam) };
|
||||
ClientToScreen(msg->hwnd, &pt2);
|
||||
|
@ -271,37 +272,18 @@ LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
|||
StackEntry * entry = NULL;
|
||||
IsTrackedWindow(child, &entry);
|
||||
|
||||
if (m_hwndUnderMouse != child)
|
||||
{
|
||||
WCHAR cn[1024];
|
||||
GetClassName(child, cn, 1023);
|
||||
DbgPrint("Mouse moved to %p (%S)\n", child, cn);
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
if (m_entryUnderMouse)
|
||||
{
|
||||
m_entryUnderMouse->mb->_ChangeHotItem(NULL, -1, HICF_MOUSE);
|
||||
}
|
||||
if (cCapture == m_captureHwnd)
|
||||
SetCapture(NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOL isTracking = FALSE;
|
||||
if (entry)
|
||||
{
|
||||
ScreenToClient(child, &pt);
|
||||
iHitTestResult = SendMessageW(child, TB_HITTEST, 0, (LPARAM) &pt);
|
||||
isTracking = entry->mb->_IsTracking();
|
||||
|
||||
BOOL isTracking = entry->mb->_IsTracking();
|
||||
|
||||
if (iHitTestResult >= 0 &&
|
||||
SendMessage(child, WM_USER_ISTRACKEDITEM, iHitTestResult, 0) == S_FALSE)
|
||||
if (SendMessage(child, WM_USER_ISTRACKEDITEM, iHitTestResult, 0) == S_FALSE)
|
||||
{
|
||||
DbgPrint("Hot item tracking detected a change (capture=%p)...\n", m_captureHwnd);
|
||||
TRACE("Hot item tracking detected a change (capture=%p)...\n", m_captureHwnd);
|
||||
DisableMouseTrack(NULL, FALSE);
|
||||
if (m_current->type == TrackedMenuEntry)
|
||||
if (isTracking && iHitTestResult>=0 && m_current->type == TrackedMenuEntry)
|
||||
SendMessage(entry->hwnd, WM_CANCELMODE, 0, 0);
|
||||
PostMessage(child, WM_USER_CHANGETRACKEDITEM, iHitTestResult, isTracking);
|
||||
if (m_current->type == TrackedMenuEntry)
|
||||
|
@ -309,14 +291,24 @@ LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
|||
}
|
||||
}
|
||||
|
||||
if (m_entryUnderMouse != entry)
|
||||
{
|
||||
// Mouse moved away from a tracked window
|
||||
if (m_entryUnderMouse)
|
||||
{
|
||||
m_entryUnderMouse->mb->_ChangeHotItem(NULL, -1, HICF_MOUSE);
|
||||
}
|
||||
if (cCapture == m_captureHwnd)
|
||||
SetCapture(NULL);
|
||||
}
|
||||
|
||||
if (m_hwndUnderMouse != child)
|
||||
{
|
||||
if (entry)
|
||||
{
|
||||
// Mouse moved to a tracked window
|
||||
if (m_current->type == MenuPopupEntry)
|
||||
{
|
||||
//SetCapture(child);
|
||||
|
||||
ScreenToClient(child, &pt2);
|
||||
SendMessage(child, WM_MOUSEMOVE, msg->wParam, MAKELPARAM(pt2.x, pt2.y));
|
||||
}
|
||||
|
@ -446,12 +438,12 @@ HRESULT CMenuFocusManager::PlaceHooks()
|
|||
{
|
||||
if (m_current->type == TrackedMenuEntry)
|
||||
{
|
||||
DbgPrint("Entering MSGFILTER hook...\n");
|
||||
TRACE("Entering MSGFILTER hook...\n");
|
||||
m_hMsgFilterHook = SetWindowsHookEx(WH_MSGFILTER, s_MsgFilterHook, NULL, m_threadId);
|
||||
}
|
||||
else
|
||||
{
|
||||
DbgPrint("Entering GETMESSAGE hook...\n");
|
||||
TRACE("Entering GETMESSAGE hook...\n");
|
||||
m_hGetMsgHook = SetWindowsHookEx(WH_GETMESSAGE, s_GetMsgHook, NULL, m_threadId);
|
||||
}
|
||||
return S_OK;
|
||||
|
@ -459,7 +451,7 @@ HRESULT CMenuFocusManager::PlaceHooks()
|
|||
|
||||
HRESULT CMenuFocusManager::RemoveHooks()
|
||||
{
|
||||
DbgPrint("Removing all hooks...\n");
|
||||
TRACE("Removing all hooks...\n");
|
||||
if (m_hMsgFilterHook)
|
||||
UnhookWindowsHookEx(m_hMsgFilterHook);
|
||||
if (m_hGetMsgHook)
|
||||
|
@ -538,11 +530,19 @@ HRESULT CMenuFocusManager::UpdateFocus()
|
|||
// When the mouse moves, it should set itself to the proper band
|
||||
SetCapture(m_current->hwnd);
|
||||
|
||||
//// FIXME: Debugging code, probably not right
|
||||
//POINT pt2;
|
||||
//GetCursorPos(&pt2);
|
||||
//ScreenToClient(m_current->hwnd, &pt2);
|
||||
//SendMessage(m_current->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(pt2.x, pt2.y));
|
||||
if (old && old->type == TrackedMenuEntry)
|
||||
{
|
||||
// FIXME: Debugging code, probably not right
|
||||
POINT pt2;
|
||||
RECT rc2;
|
||||
GetCursorPos(&pt2);
|
||||
ScreenToClient(m_current->hwnd, &pt2);
|
||||
GetClientRect(m_current->hwnd, &rc2);
|
||||
if (PtInRect(&rc2, pt2))
|
||||
SendMessage(m_current->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(pt2.x, pt2.y));
|
||||
else
|
||||
SendMessage(m_current->hwnd, WM_MOUSELEAVE, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
_ASSERT(!m_parent || m_parent->type != TrackedMenuEntry);
|
||||
|
|
|
@ -105,7 +105,7 @@ HRESULT CMenuToolbarBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
|
|||
case -714: return S_FALSE;
|
||||
|
||||
default:
|
||||
DbgPrint("WM_NOTIFY unknown code %d, %d\n", hdr->code, hdr->idFrom);
|
||||
TRACE("WM_NOTIFY unknown code %d, %d\n", hdr->code, hdr->idFrom);
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
|
@ -151,7 +151,7 @@ HRESULT CMenuToolbarBase::DisableMouseTrack(BOOL bDisable)
|
|||
if (m_disableMouseTrack != bDisable)
|
||||
{
|
||||
m_disableMouseTrack = bDisable;
|
||||
DbgPrint("DisableMouseTrack %d\n", bDisable);
|
||||
TRACE("DisableMouseTrack %d\n", bDisable);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -192,13 +192,13 @@ HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResu
|
|||
hdc = cdraw->nmcd.hdc;
|
||||
|
||||
// The item with an active submenu gets the CHECKED flag.
|
||||
isHot = m_hotBar == this && (int)cdraw->nmcd.dwItemSpec == m_hotItem;
|
||||
isPopup = m_popupBar == this && (int)cdraw->nmcd.dwItemSpec == m_popupItem;
|
||||
isHot = m_hotBar == this && (int) cdraw->nmcd.dwItemSpec == m_hotItem;
|
||||
isPopup = m_popupBar == this && (int) cdraw->nmcd.dwItemSpec == m_popupItem;
|
||||
|
||||
if (m_initFlags & SMINIT_VERTICAL)
|
||||
{
|
||||
// Remove HOT and CHECKED flags (will restore HOT if necessary)
|
||||
cdraw->nmcd.uItemState &= ~(CDIS_HOT|CDIS_CHECKED);
|
||||
cdraw->nmcd.uItemState &= ~(CDIS_HOT | CDIS_CHECKED);
|
||||
|
||||
// Decide on the colors
|
||||
if (isHot || (m_hotItem < 0 && isPopup))
|
||||
|
@ -256,8 +256,8 @@ HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResu
|
|||
// TODO: Support RTL text modes by drawing a leftwards arrow aligned to the left of the control
|
||||
|
||||
// "8" is the rightwards dropdown arrow in the Marlett font
|
||||
WCHAR text[] = L"8";
|
||||
|
||||
WCHAR text [] = L"8";
|
||||
|
||||
// Configure the font to draw with Marlett, keeping the current background color as-is
|
||||
SelectObject(cdraw->nmcd.hdc, m_marlett);
|
||||
SetBkMode(cdraw->nmcd.hdc, TRANSPARENT);
|
||||
|
@ -356,7 +356,7 @@ HRESULT CMenuToolbarBase::UpdateImageLists()
|
|||
HRESULT hr = SHGetImageList(shiml, IID_PPV_ARG(IImageList, &piml));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
{
|
||||
SendMessageW(m_hwndToolbar, TB_SETIMAGELIST, 0, 0);
|
||||
SendMessageW(m_hwndToolbar, TB_SETIMAGELIST, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -464,7 +464,7 @@ HRESULT CMenuToolbarBase::GetSizes(SIZE* pMinSize, SIZE* pMaxSize, SIZE* pIntegr
|
|||
*pMaxSize = m_idealSize;
|
||||
if (pIntegralSize)
|
||||
*pIntegralSize = m_itemSize;
|
||||
|
||||
|
||||
if (m_hasSizes)
|
||||
return S_OK;
|
||||
|
||||
|
@ -475,7 +475,7 @@ HRESULT CMenuToolbarBase::GetSizes(SIZE* pMinSize, SIZE* pMaxSize, SIZE* pIntegr
|
|||
SendMessageW(m_hwndToolbar, TB_AUTOSIZE, 0, 0);
|
||||
SendMessageW(m_hwndToolbar, TB_GETMAXSIZE, 0, reinterpret_cast<LPARAM>(&m_idealSize));
|
||||
SendMessageW(m_hwndToolbar, TB_GETIDEALSIZE, (m_initFlags & SMINIT_VERTICAL) != 0, reinterpret_cast<LPARAM>(&m_idealSize));
|
||||
|
||||
|
||||
// Obtain the button size, to be used as the integral size
|
||||
DWORD size = SendMessageW(m_hwndToolbar, TB_GETBUTTONSIZE, 0, 0);
|
||||
m_itemSize.cx = GET_X_LPARAM(size);
|
||||
|
@ -594,14 +594,14 @@ HRESULT CMenuToolbarBase::ChangeHotItem(CMenuToolbarBase * toolbar, INT item, DW
|
|||
// and mouse tracking is disabled.
|
||||
if (m_disableMouseTrack && dwFlags & HICF_MOUSE)
|
||||
{
|
||||
DbgPrint("Hot item change prevented by DisableMouseTrack\n");
|
||||
TRACE("Hot item change prevented by DisableMouseTrack\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Notify the toolbar if the hot-tracking left this toolbar
|
||||
if (m_hotBar == this && toolbar != this)
|
||||
{
|
||||
SendMessage(m_hwndToolbar, TB_SETHOTITEM, (WPARAM)-1, 0);
|
||||
SendMessage(m_hwndToolbar, TB_SETHOTITEM, (WPARAM) -1, 0);
|
||||
}
|
||||
|
||||
m_hotBar = toolbar;
|
||||
|
@ -620,7 +620,7 @@ HRESULT CMenuToolbarBase::ChangeHotItem(CMenuToolbarBase * toolbar, INT item, DW
|
|||
SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0);
|
||||
SetTimer(m_hwndToolbar, TIMERID_HOTTRACK, elapsed, NULL);
|
||||
m_timerEnabled = TRUE;
|
||||
DbgPrint("SetTimer called with m_hotItem=%d\n", m_hotItem);
|
||||
TRACE("SetTimer called with m_hotItem=%d\n", m_hotItem);
|
||||
}
|
||||
else if (m_isTrackingPopup)
|
||||
{
|
||||
|
@ -676,6 +676,9 @@ HRESULT CMenuToolbarBase::IsTrackedItem(INT index)
|
|||
if (m_hotBar != this)
|
||||
return S_FALSE;
|
||||
|
||||
if (index < 0)
|
||||
return S_FALSE;
|
||||
|
||||
if (!SendMessage(m_hwndToolbar, TB_GETBUTTON, index, reinterpret_cast<LPARAM>(&btn)))
|
||||
return E_FAIL;
|
||||
|
||||
|
@ -691,14 +694,18 @@ HRESULT CMenuToolbarBase::IsTrackedItem(INT index)
|
|||
HRESULT CMenuToolbarBase::ChangeTrackedItem(INT index, BOOL wasTracking)
|
||||
{
|
||||
TBBUTTON btn;
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
m_isTrackingPopup = FALSE;
|
||||
return m_menuBand->_ChangeHotItem(NULL, -1, HICF_MOUSE);
|
||||
}
|
||||
|
||||
if (!SendMessage(m_hwndToolbar, TB_GETBUTTON, index, reinterpret_cast<LPARAM>(&btn)))
|
||||
return E_FAIL;
|
||||
|
||||
DbgPrint("Changing tracked item to %d...\n", index);
|
||||
m_isTrackingPopup = wasTracking;
|
||||
m_menuBand->_ChangeHotItem(this, btn.idCommand, HICF_MOUSE);
|
||||
|
||||
return S_OK;
|
||||
return m_menuBand->_ChangeHotItem(this, btn.idCommand, HICF_MOUSE);
|
||||
}
|
||||
|
||||
HRESULT CMenuToolbarBase::PopupSubMenu(UINT iItem, UINT index, IShellMenu* childShellMenu)
|
||||
|
@ -747,7 +754,7 @@ HRESULT CMenuToolbarBase::PopupSubMenu(UINT iItem, UINT index, HMENU menu)
|
|||
|
||||
if (!SendMessage(m_hwndToolbar, TB_GETITEMRECT, index, reinterpret_cast<LPARAM>(&rc)))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
POINT a = { rc.left, rc.top };
|
||||
POINT b = { rc.right, rc.bottom };
|
||||
|
||||
|
@ -772,6 +779,8 @@ HRESULT CMenuToolbarBase::PopupSubMenu(UINT iItem, UINT index, HMENU menu)
|
|||
m_menuBand->_ChangePopupItem(NULL, -1);
|
||||
m_isTrackingPopup = FALSE;
|
||||
|
||||
m_menuBand->_ChangeHotItem(NULL, -1, 0);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -790,28 +799,28 @@ HRESULT CMenuToolbarBase::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theRe
|
|||
if (m_disableMouseTrack)
|
||||
{
|
||||
*theResult = 1;
|
||||
DbgPrint("Item click prevented by DisableMouseTrack\n");
|
||||
TRACE("Item click prevented by DisableMouseTrack\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// If a button is clicked while a submenu was open, cancel the submenu.
|
||||
if (!(m_initFlags & SMINIT_VERTICAL) && m_isTrackingPopup)
|
||||
{
|
||||
DbgPrint("OnCommand cancelled because it was tracking submenu.\n");
|
||||
TRACE("OnCommand cancelled because it was tracking submenu.\n");
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
|
||||
*theResult = 0;
|
||||
|
||||
m_menuBand->_KillPopupTimers();
|
||||
|
||||
if (PopupItem(wParam) == S_OK)
|
||||
{
|
||||
DbgPrint("PopupItem returned S_OK\n");
|
||||
TRACE("PopupItem returned S_OK\n");
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
DbgPrint("Executing...\n");
|
||||
TRACE("Executing...\n");
|
||||
|
||||
HRESULT hr = m_menuBand->_MenuItemHotTrack(MPOS_EXECUTE);
|
||||
|
||||
|
@ -882,7 +891,7 @@ HRESULT CMenuToolbarBase::KeyboardItemChange(DWORD dwSelectType)
|
|||
{
|
||||
if (prev != btn.idCommand)
|
||||
{
|
||||
DbgPrint("Setting Hot item to %d\n", index);
|
||||
TRACE("Setting Hot item to %d\n", index);
|
||||
m_menuBand->_ChangeHotItem(this, index, 0);
|
||||
}
|
||||
return S_OK;
|
||||
|
@ -901,7 +910,7 @@ HRESULT CMenuToolbarBase::KeyboardItemChange(DWORD dwSelectType)
|
|||
|
||||
if (prev != -1)
|
||||
{
|
||||
DbgPrint("Setting Hot item to null\n");
|
||||
TRACE("Setting Hot item to null\n");
|
||||
m_menuBand->_ChangeHotItem(NULL, -1, 0);
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1040,7 @@ HRESULT CMenuToolbarBase::PopupItem(INT iItem)
|
|||
|
||||
if (!(m_initFlags & SMINIT_VERTICAL))
|
||||
{
|
||||
DbgPrint("PopupItem non-vertical %d %d\n", index, iItem);
|
||||
TRACE("PopupItem non-vertical %d %d\n", index, iItem);
|
||||
m_menuBand->_ChangeHotItem(this, iItem, 0);
|
||||
}
|
||||
|
||||
|
@ -1096,7 +1105,7 @@ HRESULT CMenuStaticToolbar::FillToolbar(BOOL clearFirst)
|
|||
|
||||
if (!GetMenuItemInfoW(m_hmenu, i, TRUE, &info))
|
||||
{
|
||||
DbgPrint("Error obtaining info for menu item at pos=%d\n", i);
|
||||
TRACE("Error obtaining info for menu item at pos=%d\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1186,7 +1195,6 @@ HRESULT CMenuStaticToolbar::InternalHasSubMenu(INT iItem, INT index, DWORD_PTR d
|
|||
return ::GetSubMenu(m_hmenu, index) ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
|
||||
CMenuSFToolbar::CMenuSFToolbar(CMenuBand * menuBand) :
|
||||
CMenuToolbarBase(menuBand, TRUE),
|
||||
m_shellFolder(NULL),
|
||||
|
@ -1350,11 +1358,6 @@ HRESULT CMenuSFToolbar::InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData
|
|||
#endif
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUBAND
|
||||
hr = CMenuBand_Wrapper(shellMenu, IID_PPV_ARG(IShellMenu, &shellMenu));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
m_menuBand->GetMenuInfo(&psmc, &uId, &uIdAncestor, &flags);
|
||||
|
||||
|
|
|
@ -158,11 +158,6 @@ private:
|
|||
#endif
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUBAND
|
||||
hr = CMenuBand_Wrapper(pShellMenu, IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
hr = pShellMenu->Initialize(this, 0, ANCESTORDEFAULT, SMINIT_VERTICAL);
|
||||
|
||||
|
@ -298,51 +293,36 @@ CStartMenu_Constructor(REFIID riid, void **ppv)
|
|||
|
||||
#if USE_SYSTEM_MENUBAND
|
||||
hr = CoCreateInstance(CLSID_MenuBand,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
#else
|
||||
hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
#endif
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUBAND
|
||||
hr = CMenuBand_Wrapper(pShellMenu, IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
#if USE_SYSTEM_MENUSITE
|
||||
hr = CoCreateInstance(CLSID_MenuBandSite,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IBandSite, &pBandSite));
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IBandSite, &pBandSite));
|
||||
#else
|
||||
hr = CMenuSite_Constructor(IID_PPV_ARG(IBandSite, &pBandSite));
|
||||
#endif
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUSITE
|
||||
hr = CMenuSite_Wrapper(pBandSite, IID_PPV_ARG(IBandSite, &pBandSite));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
#if USE_SYSTEM_MENUDESKBAR
|
||||
hr = CoCreateInstance(CLSID_MenuDeskBar,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
#else
|
||||
hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
#endif
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUDESKBAR
|
||||
hr = CMenuDeskBar_Wrapper(pDeskBar, IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
CComObject<CShellMenuCallback> *pCallback;
|
||||
hr = CComObject<CShellMenuCallback>::CreateInstance(&pCallback);
|
||||
|
@ -351,7 +331,7 @@ CStartMenu_Constructor(REFIID riid, void **ppv)
|
|||
pCallback->AddRef(); // CreateInstance returns object with 0 ref count */
|
||||
pCallback->Initialize(pShellMenu, pBandSite, pDeskBar);
|
||||
|
||||
pShellMenu->Initialize(pCallback, (UINT)-1, 0, SMINIT_TOPLEVEL | SMINIT_VERTICAL);
|
||||
pShellMenu->Initialize(pCallback, (UINT) -1, 0, SMINIT_TOPLEVEL | SMINIT_VERTICAL);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
|
|
|
@ -1,742 +0,0 @@
|
|||
/*
|
||||
* Shell Menu Band
|
||||
*
|
||||
* Copyright 2014 David Quintana
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include "precomp.h"
|
||||
#include "wraplog.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(CMenuBandWrap);
|
||||
|
||||
class CMenuBandWrap :
|
||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||
public IDeskBand,
|
||||
public IObjectWithSite,
|
||||
public IInputObject,
|
||||
public IPersistStream,
|
||||
public IOleCommandTarget,
|
||||
public IServiceProvider,
|
||||
public IMenuPopup,
|
||||
public IMenuBand,
|
||||
public IShellMenu2,
|
||||
public IWinEventHandler,
|
||||
public IShellMenuAcc
|
||||
{
|
||||
public:
|
||||
CMenuBandWrap() {}
|
||||
~CMenuBandWrap();
|
||||
|
||||
HRESULT InitWrap(IShellMenu * shellMenu);
|
||||
|
||||
private:
|
||||
CComPtr<IDeskBand > m_IDeskBand;
|
||||
CComPtr<IDockingWindow > m_IDockingWindow;
|
||||
CComPtr<IOleWindow > m_IOleWindow;
|
||||
CComPtr<IObjectWithSite > m_IObjectWithSite;
|
||||
CComPtr<IInputObject > m_IInputObject;
|
||||
CComPtr<IPersistStream > m_IPersistStream;
|
||||
CComPtr<IPersist > m_IPersist;
|
||||
CComPtr<IOleCommandTarget > m_IOleCommandTarget;
|
||||
CComPtr<IServiceProvider > m_IServiceProvider;
|
||||
CComPtr<IMenuPopup > m_IMenuPopup;
|
||||
CComPtr<IDeskBar > m_IDeskBar;
|
||||
CComPtr<IMenuBand > m_IMenuBand;
|
||||
CComPtr<IShellMenu2 > m_IShellMenu2;
|
||||
CComPtr<IShellMenu > m_IShellMenu;
|
||||
CComPtr<IWinEventHandler > m_IWinEventHandler;
|
||||
CComPtr<IShellMenuAcc > m_IShellMenuAcc;
|
||||
|
||||
IUnknown * m_site;
|
||||
|
||||
public:
|
||||
|
||||
// *** IDeskBand methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
|
||||
|
||||
// *** IDockingWindow methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
|
||||
virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved);
|
||||
virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
|
||||
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
|
||||
|
||||
// *** IObjectWithSite methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite);
|
||||
|
||||
// *** IInputObject methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
|
||||
virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
|
||||
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
|
||||
|
||||
// *** IPersistStream methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE IsDirty();
|
||||
virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
|
||||
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
|
||||
|
||||
// *** IPersist methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
|
||||
|
||||
// *** 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);
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
|
||||
|
||||
// *** IMenuPopup methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet);
|
||||
|
||||
// *** IDeskBar methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(RECT *prc);
|
||||
|
||||
// *** IMenuBand methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE IsMenuMessage(MSG *pmsg);
|
||||
virtual HRESULT STDMETHODCALLTYPE TranslateMenuMessage(MSG *pmsg, LRESULT *plRet);
|
||||
|
||||
// *** IShellMenu methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor, DWORD dwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE InvalidateItem(LPSMDATA psmd, DWORD dwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetState(LPSMDATA psmd);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetMenuToolbar(IUnknown *punk, DWORD dwFlags);
|
||||
|
||||
// *** IWinEventHandler methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
||||
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
|
||||
|
||||
// *** IShellMenu2 methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSubMenu(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetToolbar(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetMinWidth(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetNoBorder(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetTheme(THIS);
|
||||
|
||||
// *** IShellMenuAcc methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE GetTop(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBottom(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetTracked(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetParentSite(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetState(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE DoDefaultAction(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE IsEmpty(THIS);
|
||||
|
||||
DECLARE_NOT_AGGREGATABLE(CMenuBandWrap)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(CMenuBandWrap)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IShellMenu, IShellMenu)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IDeskBand)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersistStream)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IMenuBand, IMenuBand)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IShellMenu2, IShellMenu2)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IShellMenuAcc, IShellMenuAcc)
|
||||
END_COM_MAP()
|
||||
};
|
||||
|
||||
extern "C"
|
||||
HRESULT WINAPI CMenuBand_Wrapper(IShellMenu * shellMenu, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
CMenuBandWrap * site = new CComObject<CMenuBandWrap>();
|
||||
|
||||
if (!site)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = site->InitWrap(shellMenu);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
{
|
||||
site->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = site->QueryInterface(riid, ppv);
|
||||
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
site->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CMenuBandWrap::InitWrap(IShellMenu * shellMenu)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
WrapLogOpen();
|
||||
|
||||
m_IShellMenu = shellMenu;
|
||||
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IDeskBand, &m_IDeskBand));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IDockingWindow, &m_IDockingWindow));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite, &m_IObjectWithSite));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IPersistStream, &m_IPersistStream));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IPersist, &m_IPersist));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_IMenuPopup));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IDeskBar, &m_IDeskBar));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IMenuBand, &m_IMenuBand));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IShellMenu2, &m_IShellMenu2));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = shellMenu->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_IWinEventHandler));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
//hr = shellMenu->QueryInterface(IID_PPV_ARG(IShellMenuAcc, &m_IShellMenuAcc));
|
||||
m_IShellMenuAcc = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
CMenuBandWrap::~CMenuBandWrap()
|
||||
{
|
||||
WrapLogClose();
|
||||
}
|
||||
|
||||
|
||||
// *** IShellMenu2 methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetSubMenu(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetSubMenu()\n", this);
|
||||
HRESULT hr = m_IShellMenu2->GetSubMenu();
|
||||
WrapLogExit("CMenuBandWrap::GetSubMenu()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetToolbar(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetToolbar()\n", this);
|
||||
HRESULT hr = m_IShellMenu2->SetToolbar();
|
||||
WrapLogExit("CMenuBandWrap::SetToolbar()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetMinWidth(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetMinWidth()\n", this);
|
||||
HRESULT hr = m_IShellMenu2->SetMinWidth();
|
||||
WrapLogExit("CMenuBandWrap::SetMinWidth()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetNoBorder(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetNoBorder()\n", this);
|
||||
HRESULT hr = m_IShellMenu2->SetNoBorder();
|
||||
WrapLogExit("CMenuBandWrap::SetNoBorder()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetTheme(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetTheme()\n", this);
|
||||
HRESULT hr = m_IShellMenu2->SetTheme();
|
||||
WrapLogExit("CMenuBandWrap::SetTheme()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
// *** IShellMenuAcc methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetTop(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetTop()\n", this);
|
||||
HRESULT hr = m_IShellMenuAcc->GetTop();
|
||||
WrapLogExit("CMenuBandWrap::GetTop()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetBottom(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
|
||||
HRESULT hr = m_IShellMenuAcc->GetBottom();
|
||||
WrapLogExit("CMenuBandWrap::GetBottom()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetTracked(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
|
||||
HRESULT hr = m_IShellMenuAcc->GetBottom();
|
||||
WrapLogExit("CMenuBandWrap::GetBottom()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetParentSite(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
|
||||
HRESULT hr = m_IShellMenuAcc->GetBottom();
|
||||
WrapLogExit("CMenuBandWrap::GetBottom()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetState(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
|
||||
HRESULT hr = m_IShellMenuAcc->GetBottom();
|
||||
WrapLogExit("CMenuBandWrap::GetBottom()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::DoDefaultAction(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
|
||||
HRESULT hr = m_IShellMenuAcc->GetBottom();
|
||||
WrapLogExit("CMenuBandWrap::GetBottom()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsEmpty(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
|
||||
HRESULT hr = m_IShellMenuAcc->GetBottom();
|
||||
WrapLogExit("CMenuBandWrap::GetBottom()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IDeskBand methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetBandInfo(DWORD dwBandID=%d, DWORD dwViewMode=%d, DESKBANDINFO *pdbi=%p)\n", this, dwBandID, dwViewMode, pdbi);
|
||||
HRESULT hr = m_IDeskBand->GetBandInfo(dwBandID, dwViewMode, pdbi);
|
||||
WrapLogExit("CMenuBandWrap::GetBandInfo()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IDockingWindow methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::ShowDW(BOOL fShow)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::ShowDW(BOOL fShow=%d)\n", this, fShow);
|
||||
HRESULT hr = m_IDockingWindow->ShowDW(fShow);
|
||||
WrapLogExit("CMenuBandWrap::ShowDW()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::CloseDW(DWORD dwReserved)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::CloseDW(DWORD dwReserved=%d)\n", this, dwReserved);
|
||||
HRESULT hr = m_IDockingWindow->CloseDW(dwReserved);
|
||||
WrapLogExit("CMenuBandWrap::CloseDW()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::ResizeBorderDW(LPCRECT prcBorder=%p, IUnknown *punkToolbarSite=%p, BOOL fReserved=%d)\n", this, prcBorder, punkToolbarSite, fReserved);
|
||||
if (prcBorder) WrapLogPre("*prcBorder=%s\n", Wrap(*prcBorder));
|
||||
HRESULT hr = m_IDockingWindow->ResizeBorderDW(prcBorder, punkToolbarSite, fReserved);
|
||||
if (prcBorder) WrapLogPost("*prcBorder=%s\n", Wrap(*prcBorder));
|
||||
WrapLogExit("CMenuBandWrap::ResizeBorderDW()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetWindow(HWND *phwnd)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd);
|
||||
HRESULT hr = m_IOleWindow->GetWindow(phwnd);
|
||||
if (phwnd) WrapLogPost("*phwnd=%p\n", *phwnd);
|
||||
WrapLogExit("CMenuBandWrap::GetWindow()", hr);
|
||||
return hr;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::ContextSensitiveHelp(BOOL fEnterMode)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode);
|
||||
HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode);
|
||||
WrapLogExit("CMenuBandWrap::ContextSensitiveHelp()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IWinEventHandler methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
|
||||
{
|
||||
//WrapLogEnter("CMenuBandWrap<%p>::OnWinEvent(HWND hWnd=%p, UINT uMsg=%u, WPARAM wParam=%08x, LPARAM lParam=%08x, LRESULT *theResult=%p)\n", this, hWnd, uMsg, wParam, lParam, theResult);
|
||||
HRESULT hr = m_IWinEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
|
||||
//WrapLogExit("CMenuBandWrap::OnWinEvent()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsWindowOwner(HWND hWnd)
|
||||
{
|
||||
//WrapLogEnter("CMenuBandWrap<%p>::IsWindowOwner(HWND hWnd=%08x)\n", this, hWnd);
|
||||
HRESULT hr = m_IWinEventHandler->IsWindowOwner(hWnd);
|
||||
//WrapLogExit("CMenuBandWrap::IsWindowOwner()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IObjectWithSite methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetSite(IUnknown *pUnkSite)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite);
|
||||
HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite);
|
||||
WrapLogExit("CMenuBandWrap::SetSite()", hr);
|
||||
m_site = pUnkSite;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetSite(REFIID riid, PVOID *ppvSite)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid), ppvSite);
|
||||
HRESULT hr = m_IObjectWithSite->GetSite(riid, ppvSite);
|
||||
if (ppvSite) WrapLogPost("*ppvSite=%p\n", *ppvSite);
|
||||
WrapLogExit("CMenuBandWrap::GetSite()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObject methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::UIActivateIO(BOOL fActivate=%d, LPMSG lpMsg=%p)\n", this, fActivate, lpMsg);
|
||||
HRESULT hr = m_IInputObject->UIActivateIO(fActivate, lpMsg);
|
||||
WrapLogExit("CMenuBandWrap::UIActivateIO()", hr);
|
||||
|
||||
HRESULT hrt;
|
||||
CComPtr<IMenuPopup> pmp;
|
||||
|
||||
hrt = IUnknown_QueryService(m_site, SID_SMenuPopup, IID_PPV_ARG(IMenuPopup, &pmp));
|
||||
if (FAILED(hrt))
|
||||
return hr;
|
||||
|
||||
hrt = pmp->SetSubMenu(this, fActivate);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::HasFocusIO()
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::HasFocusIO()\n", this);
|
||||
HRESULT hr = m_IInputObject->HasFocusIO();
|
||||
WrapLogExit("CMenuBandWrap::HasFocusIO()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::TranslateAcceleratorIO(LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg);
|
||||
if (lpMsg) WrapLogPre("*lpMsg=%s\n", Wrap(*lpMsg));
|
||||
HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg);
|
||||
WrapLogExit("CMenuBandWrap::TranslateAcceleratorIO()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IPersistStream methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsDirty()
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::IsDirty()\n", this);
|
||||
HRESULT hr = m_IPersistStream->IsDirty();
|
||||
WrapLogExit("CMenuBandWrap::IsDirty()", hr);
|
||||
return hr;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::Load(IStream *pStm)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::Load(IStream *pStm=%p)\n", this, pStm);
|
||||
HRESULT hr = m_IPersistStream->Load(pStm);
|
||||
WrapLogExit("CMenuBandWrap::Load()", hr);
|
||||
return hr;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::Save(IStream *pStm, BOOL fClearDirty)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::Save(IStream *pStm=%p, BOOL fClearDirty=%d)\n", this, pStm, fClearDirty);
|
||||
HRESULT hr = m_IPersistStream->Save(pStm, fClearDirty);
|
||||
WrapLogExit("CMenuBandWrap::Save()", hr);
|
||||
return hr;
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetSizeMax(ULARGE_INTEGER *pcbSize)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetSizeMax(ULARGE_INTEGER *pcbSize=%p)\n", this, pcbSize);
|
||||
HRESULT hr = m_IPersistStream->GetSizeMax(pcbSize);
|
||||
WrapLogExit("CMenuBandWrap::GetSizeMax()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IPersist methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetClassID(CLSID *pClassID)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetClassID(CLSID *pClassID=%p)\n", this, pClassID);
|
||||
HRESULT hr = m_IPersist->GetClassID(pClassID);
|
||||
if (pClassID) WrapLogPost("*pClassID=%s\n", Wrap(*pClassID));
|
||||
WrapLogExit("CMenuBandWrap::GetClassID()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleCommandTarget methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::QueryStatus(const GUID *pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
HRESULT hr = m_IOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
if (pguidCmdGroup) WrapLogPost("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
WrapLogExit("CMenuBandWrap::QueryStatus()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::Exec(const GUID *pguidCmdGroup=%p, DWORD nCmdID=%d, DWORD nCmdexecopt=%d, VARIANT *pvaIn=%p, VARIANT *pvaOut=%p)\n", this, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
if (pguidCmdGroup) WrapLogPre("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
WrapLogExit("CMenuBandWrap::Exec()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject);
|
||||
|
||||
if (IsEqualIID(guidService, SID_SMenuBandChild))
|
||||
{
|
||||
WrapLogPre("SID is SID_SMenuBandChild. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuBandWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogPre("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else if (IsEqualIID(guidService, SID_SMenuBandBottom))
|
||||
{
|
||||
WrapLogPre("SID is SID_SMenuBandBottom. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuBandWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogPre("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else if (IsEqualIID(guidService, SID_SMenuBandBottomSelected))
|
||||
{
|
||||
WrapLogPre("SID is SID_SMenuBandBottomSelected. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuBandWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogPre("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogPre("SID not identified.\n");
|
||||
}
|
||||
HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject);
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuBandWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
// *** IMenuPopup methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt, prcExclude, dwFlags);
|
||||
HRESULT hr = m_IMenuPopup->Popup(ppt, prcExclude, dwFlags);
|
||||
WrapLogExit("CMenuBandWrap::Popup()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::OnSelect(DWORD dwSelectType)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType);
|
||||
HRESULT hr = m_IMenuPopup->OnSelect(dwSelectType);
|
||||
WrapLogExit("CMenuBandWrap::OnSelect()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetSubMenu(IMenuPopup *pmp, BOOL fSet)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp, fSet);
|
||||
HRESULT hr = m_IMenuPopup->SetSubMenu(pmp, fSet);
|
||||
WrapLogExit("CMenuBandWrap::SetSubMenu()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
// *** IDeskBar methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetClient(IUnknown *punkClient)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient);
|
||||
HRESULT hr = m_IDeskBar->SetClient(punkClient);
|
||||
WrapLogExit("CMenuBandWrap::SetClient()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetClient(IUnknown **ppunkClient)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient);
|
||||
HRESULT hr = m_IDeskBar->GetClient(ppunkClient);
|
||||
if (ppunkClient) WrapLogPost("*ppunkClient=%p\n", *ppunkClient);
|
||||
WrapLogExit("CMenuBandWrap::GetClient()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::OnPosRectChangeDB(RECT *prc)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc);
|
||||
HRESULT hr = m_IDeskBar->OnPosRectChangeDB(prc);
|
||||
if (prc) WrapLogPost("*prc=%s\n", Wrap(*prc));
|
||||
WrapLogExit("CMenuBandWrap::OnPosRectChangeDB()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
// *** IMenuBand methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::IsMenuMessage(MSG *pmsg)
|
||||
{
|
||||
//WrapLogEnter("CMenuBandWrap<%p>::IsMenuMessage(MSG *pmsg=%p)\n", this, pmsg);
|
||||
HRESULT hr = m_IMenuBand->IsMenuMessage(pmsg);
|
||||
//WrapLogExit("CMenuBandWrap::IsMenuMessage()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::TranslateMenuMessage(MSG *pmsg, LRESULT *plRet)
|
||||
{
|
||||
//WrapLogEnter("CMenuBandWrap<%p>::TranslateMenuMessage(MSG *pmsg=%p, LRESULT *plRet=%p)\n", this, pmsg, plRet);
|
||||
HRESULT hr = m_IMenuBand->TranslateMenuMessage(pmsg, plRet);
|
||||
//WrapLogExit("CMenuBandWrap::TranslateMenuMessage(*plRet=%d) = %08x\n", *plRet, hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IShellMenu methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor, DWORD dwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::Initialize(IShellMenuCallback *psmc=%p, UINT uId=%u, UINT uIdAncestor=%u, DWORD dwFlags=%08x)\n", this, psmc, uId, uIdAncestor, dwFlags);
|
||||
HRESULT hr = m_IShellMenu->Initialize(psmc, uId, uIdAncestor, dwFlags);
|
||||
WrapLogExit("CMenuBandWrap::Initialize()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetMenuInfo(IShellMenuCallback **ppsmc=%p, UINT *puId=%p, UINT *puIdAncestor=%p, DWORD *pdwFlags=%p)\n", this, ppsmc, puId, puIdAncestor, pdwFlags);
|
||||
HRESULT hr = m_IShellMenu->GetMenuInfo(ppsmc, puId, puIdAncestor, pdwFlags);
|
||||
if (ppsmc) WrapLogPost("*ppsmc=%p\n", *ppsmc);
|
||||
if (puId) WrapLogPost("*puId=%u\n", *puId);
|
||||
if (puIdAncestor) WrapLogPost("*puIdAncestor=%u\n", *puIdAncestor);
|
||||
if (pdwFlags) WrapLogPost("*pdwFlags=%08x\n", *pdwFlags);
|
||||
WrapLogExit("CMenuBandWrap::GetMenuInfo()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetShellFolder(IShellFolder *psf=%p, LPCITEMIDLIST pidlFolder=%p, HKEY hKey=%p, DWORD dwFlags=%08x)\n", this, psf, pidlFolder, hKey, dwFlags);
|
||||
HRESULT hr = m_IShellMenu->SetShellFolder(psf, pidlFolder, hKey, dwFlags);
|
||||
WrapLogExit("CMenuBandWrap::SetShellFolder()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetShellFolder(DWORD *pdwFlags=%p, LPITEMIDLIST *ppidl=%p, REFIID riid=%s, void **ppv=%p)\n", this, pdwFlags, ppidl, Wrap(riid), ppv);
|
||||
HRESULT hr = m_IShellMenu->GetShellFolder(pdwFlags, ppidl, riid, ppv);
|
||||
if (pdwFlags) WrapLogPost("*pdwFlags=%08x\n", *pdwFlags);
|
||||
if (ppidl) WrapLogPost("*ppidl=%p\n", *ppidl);
|
||||
if (ppv) WrapLogPost("*ppv=%p\n", *ppv);
|
||||
WrapLogExit("CMenuBandWrap::GetShellFolder()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetMenu(HMENU hmenu=%p, HWND hwnd=%p, DWORD dwFlags=%08x)\n", this, hmenu, hwnd, dwFlags);
|
||||
HRESULT hr = m_IShellMenu->SetMenu(hmenu, hwnd, dwFlags);
|
||||
WrapLogExit("CMenuBandWrap::SetMenu()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetMenu(HMENU *phmenu=%p, HWND *phwnd=%p, DWORD *pdwFlags=%p)\n", this, phmenu, phwnd, pdwFlags);
|
||||
HRESULT hr = m_IShellMenu->GetMenu(phmenu, phwnd, pdwFlags);
|
||||
if (phmenu) WrapLogPost("*phmenu=%p\n", *phmenu);
|
||||
if (phwnd) WrapLogPost("*phwnd=%p\n", *phwnd);
|
||||
if (pdwFlags) WrapLogPost("*pdwFlags=%08x\n", *pdwFlags);
|
||||
WrapLogExit("CMenuBandWrap::GetMenu()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::InvalidateItem(LPSMDATA psmd, DWORD dwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::InvalidateItem(LPSMDATA psmd=%p, DWORD dwFlags=%08x)\n", this, psmd, dwFlags);
|
||||
HRESULT hr = m_IShellMenu->InvalidateItem(psmd, dwFlags);
|
||||
WrapLogExit("CMenuBandWrap::InvalidateItem()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::GetState(LPSMDATA psmd)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::GetState(LPSMDATA psmd=%p)\n", this, psmd);
|
||||
HRESULT hr = m_IShellMenu->GetState(psmd);
|
||||
WrapLogExit("CMenuBandWrap::GetState()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBandWrap::SetMenuToolbar(IUnknown *punk, DWORD dwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuBandWrap<%p>::SetMenuToolbar(IUnknown *punk=%p, DWORD dwFlags=%08x)\n", this, punk, dwFlags);
|
||||
HRESULT hr = m_IShellMenu->SetMenuToolbar(punk, dwFlags);
|
||||
WrapLogExit("CMenuBandWrap::SetMenuToolbar()", hr);
|
||||
return hr;
|
||||
}
|
|
@ -1,439 +0,0 @@
|
|||
/*
|
||||
* Shell Menu Desk Bar
|
||||
*
|
||||
* Copyright 2014 David Quintana
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include "precomp.h"
|
||||
#include "wraplog.h"
|
||||
|
||||
class CMenuDeskBarWrap :
|
||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||
public IOleCommandTarget,
|
||||
public IServiceProvider,
|
||||
public IInputObjectSite,
|
||||
public IInputObject,
|
||||
public IMenuPopup,
|
||||
public IObjectWithSite,
|
||||
public IBanneredBar,
|
||||
public IInitializeObject
|
||||
{
|
||||
public:
|
||||
CMenuDeskBarWrap() {}
|
||||
~CMenuDeskBarWrap();
|
||||
|
||||
HRESULT InitWrap(IDeskBar * shellMenu);
|
||||
|
||||
private:
|
||||
CComPtr<IMenuPopup > m_IMenuPopup;
|
||||
CComPtr<IOleCommandTarget > m_IOleCommandTarget;
|
||||
CComPtr<IServiceProvider > m_IServiceProvider;
|
||||
CComPtr<IDeskBar > m_IDeskBar;
|
||||
CComPtr<IOleWindow > m_IOleWindow;
|
||||
CComPtr<IInputObjectSite > m_IInputObjectSite;
|
||||
CComPtr<IInputObject > m_IInputObject;
|
||||
CComPtr<IObjectWithSite > m_IObjectWithSite;
|
||||
CComPtr<IBanneredBar > m_IBanneredBar;
|
||||
CComPtr<IInitializeObject > m_IInitializeObject;
|
||||
|
||||
public:
|
||||
// *** IMenuPopup methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet);
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
|
||||
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
|
||||
|
||||
// *** IObjectWithSite methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite);
|
||||
|
||||
// *** IBanneredBar methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetIconSize(DWORD iIcon);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetIconSize(DWORD* piIcon);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetBitmap(HBITMAP hBitmap);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBitmap(HBITMAP* phBitmap);
|
||||
|
||||
// *** IInitializeObject methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE Initialize(THIS);
|
||||
|
||||
// *** 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);
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
|
||||
|
||||
// *** IInputObjectSite methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus);
|
||||
|
||||
// *** IInputObject methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL bActivating, LPMSG lpMsg);
|
||||
virtual HRESULT STDMETHODCALLTYPE HasFocusIO(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
|
||||
|
||||
// *** IDeskBar methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(LPRECT prc);
|
||||
|
||||
DECLARE_NOT_AGGREGATABLE(CMenuDeskBarWrap)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(CMenuDeskBarWrap)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IBanneredBar, IBanneredBar)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInitializeObject, IInitializeObject)
|
||||
END_COM_MAP()
|
||||
};
|
||||
|
||||
extern "C"
|
||||
HRESULT WINAPI CMenuDeskBar_Wrapper(IDeskBar * deskBar, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
CMenuDeskBarWrap * bar = new CComObject<CMenuDeskBarWrap>();
|
||||
if (!bar)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = bar->InitWrap(deskBar);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
{
|
||||
bar->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = bar->QueryInterface(riid, ppv);
|
||||
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
bar->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CMenuDeskBarWrap::InitWrap(IDeskBar * deskBar)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
WrapLogOpen();
|
||||
|
||||
m_IDeskBar = deskBar;
|
||||
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_IMenuPopup));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IInputObjectSite, &m_IInputObjectSite));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &m_IObjectWithSite));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IBanneredBar, &m_IBanneredBar));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IInitializeObject, &m_IInitializeObject));
|
||||
return hr;
|
||||
}
|
||||
|
||||
CMenuDeskBarWrap::~CMenuDeskBarWrap()
|
||||
{
|
||||
WrapLogClose();
|
||||
}
|
||||
|
||||
// *** IMenuPopup methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt, prcExclude, dwFlags);
|
||||
HRESULT hr = m_IMenuPopup->Popup(ppt, prcExclude, dwFlags);
|
||||
WrapLogExit("CMenuDeskBarWrap::Popup()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnSelect(DWORD dwSelectType)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType);
|
||||
HRESULT hr = m_IMenuPopup->OnSelect(dwSelectType);
|
||||
WrapLogExit("CMenuDeskBarWrap::OnSelect()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetSubMenu(IMenuPopup *pmp, BOOL fSet)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp, fSet);
|
||||
HRESULT hr = m_IMenuPopup->SetSubMenu(pmp, fSet);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetSubMenu()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetWindow(HWND *phwnd)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd);
|
||||
HRESULT hr = m_IOleWindow->GetWindow(phwnd);
|
||||
if (phwnd) WrapLogPost("*phwnd=%p\n", *phwnd);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetWindow()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::ContextSensitiveHelp(BOOL fEnterMode)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode);
|
||||
HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode);
|
||||
WrapLogExit("CMenuDeskBarWrap::ContextSensitiveHelp()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IObjectWithSite methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetSite(IUnknown *pUnkSite)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite);
|
||||
|
||||
#if WRAP_TRAYPRIV
|
||||
CComPtr<ITrayPriv> inTp;
|
||||
HRESULT hr2 = pUnkSite->QueryInterface(IID_PPV_ARG(ITrayPriv, &inTp));
|
||||
if (SUCCEEDED(hr2))
|
||||
{
|
||||
ITrayPriv * outTp;
|
||||
hr2 = CStartMenuSite_Wrapper(inTp, IID_PPV_ARG(ITrayPriv, &outTp));
|
||||
if (SUCCEEDED(hr2))
|
||||
{
|
||||
pUnkSite = outTp;
|
||||
}
|
||||
else
|
||||
{
|
||||
outTp->Release();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetSite()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetSite(REFIID riid, PVOID *ppvSite)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid), ppvSite);
|
||||
HRESULT hr = m_IObjectWithSite->GetSite(riid, ppvSite);
|
||||
if (ppvSite) WrapLogPost("*ppvSite=%p\n", *ppvSite);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetSite()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IBanneredBar methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetIconSize(DWORD iIcon)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetIconSize(DWORD iIcon=%d)\n", this, iIcon);
|
||||
HRESULT hr = m_IBanneredBar->SetIconSize(iIcon);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetIconSize()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetIconSize(DWORD* piIcon)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetIconSize(DWORD* piIcon=%p)\n", this, piIcon);
|
||||
HRESULT hr = m_IBanneredBar->GetIconSize(piIcon);
|
||||
if (piIcon) WrapLogPost("*piIcon=%d\n", *piIcon);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetIconSize()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetBitmap(HBITMAP hBitmap)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetBitmap(HBITMAP hBitmap=%p)\n", this, hBitmap);
|
||||
HRESULT hr = m_IBanneredBar->SetBitmap(hBitmap);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetBitmap()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetBitmap(HBITMAP* phBitmap)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetBitmap(HBITMAP* phBitmap=%p)\n", this, phBitmap);
|
||||
HRESULT hr = m_IBanneredBar->GetBitmap(phBitmap);
|
||||
if (phBitmap) WrapLogPost("*phBitmap=%p\n", *phBitmap);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetBitmap()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
// *** IInitializeObject methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Initialize(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::Initialize()\n", this);
|
||||
HRESULT hr = m_IInitializeObject->Initialize();
|
||||
WrapLogExit("CMenuDeskBarWrap::Initialize()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleCommandTarget methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::QueryStatus(const GUID *pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
HRESULT hr = m_IOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
if (pguidCmdGroup) WrapLogPost("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryStatus()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::Exec(const GUID *pguidCmdGroup=%p, DWORD nCmdID=%d, DWORD nCmdexecopt=%d, VARIANT *pvaIn=%p, VARIANT *pvaOut=%p)\n", this, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
if (pguidCmdGroup) WrapLogPost("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
WrapLogExit("CMenuDeskBarWrap::Exec()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject);
|
||||
|
||||
if (IsEqualIID(guidService, SID_SMenuPopup))
|
||||
{
|
||||
WrapLogPre("SID is SID_SMenuPopup. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogPre("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else if (IsEqualIID(guidService, SID_SMenuBandParent))
|
||||
{
|
||||
WrapLogPre("SID is SID_SMenuBandParent. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogPre("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else if (IsEqualIID(guidService, SID_STopLevelBrowser))
|
||||
{
|
||||
WrapLogPre("SID is SID_STopLevelBrowser. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogPre("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogPre("SID not identified. Calling wrapped object's QueryService.\n");
|
||||
}
|
||||
HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject);
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObjectSite methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::OnFocusChangeIS(LPUNKNOWN lpUnknown=%p, BOOL bFocus=%d)\n", this, lpUnknown, bFocus);
|
||||
HRESULT hr = m_IInputObjectSite->OnFocusChangeIS(lpUnknown, bFocus);
|
||||
WrapLogExit("CMenuDeskBarWrap::OnFocusChangeIS()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObject methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::UIActivateIO(BOOL bActivating, LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::UIActivateIO(BOOL bActivating=%d, LPMSG lpMsg=%p)\n", this, bActivating, lpMsg);
|
||||
HRESULT hr = m_IInputObject->UIActivateIO(bActivating, lpMsg);
|
||||
WrapLogExit("CMenuDeskBarWrap::UIActivateIO()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::HasFocusIO(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::HasFocusIO()\n", this);
|
||||
HRESULT hr = m_IInputObject->HasFocusIO();
|
||||
WrapLogExit("CMenuDeskBarWrap::HasFocusIO()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::TranslateAcceleratorIO(LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg);
|
||||
if (lpMsg) WrapLogPre("*lpMsg=%s\n", Wrap(*lpMsg));
|
||||
HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg);
|
||||
WrapLogExit("CMenuDeskBarWrap::TranslateAcceleratorIO()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IDeskBar methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetClient(IUnknown *punkClient)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient);
|
||||
HRESULT hr = m_IDeskBar->SetClient(punkClient);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetClient()", hr);
|
||||
|
||||
CComPtr<IDeskBarClient> dbc;
|
||||
punkClient->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc));
|
||||
dbc->SetDeskBarSite(static_cast<IDeskBar*>(this));
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetClient(IUnknown **ppunkClient)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient);
|
||||
HRESULT hr = m_IDeskBar->GetClient(ppunkClient);
|
||||
if (ppunkClient) WrapLogPost("*ppunkClient=%p\n", *ppunkClient);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetClient()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnPosRectChangeDB(LPRECT prc)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc);
|
||||
HRESULT hr = m_IDeskBar->OnPosRectChangeDB(prc);
|
||||
if (prc) WrapLogPost("*prc=%s\n", Wrap(*prc));
|
||||
WrapLogExit("CMenuDeskBarWrap::OnPosRectChangeDB()", hr);
|
||||
return hr;
|
||||
}
|
|
@ -1,364 +0,0 @@
|
|||
/*
|
||||
* Shell Menu Site
|
||||
*
|
||||
* Copyright 2014 David Quintana
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "wraplog.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(menusite);
|
||||
|
||||
class CMenuSiteWrap :
|
||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||
public IBandSite,
|
||||
public IDeskBarClient,
|
||||
public IOleCommandTarget,
|
||||
public IInputObject,
|
||||
public IInputObjectSite,
|
||||
public IWinEventHandler,
|
||||
public IServiceProvider
|
||||
{
|
||||
public:
|
||||
CMenuSiteWrap() {}
|
||||
~CMenuSiteWrap();
|
||||
|
||||
HRESULT InitWrap(IBandSite * bandSite);
|
||||
|
||||
private:
|
||||
CComPtr<IBandSite > m_IBandSite;
|
||||
CComPtr<IDeskBarClient > m_IDeskBarClient;
|
||||
CComPtr<IOleWindow > m_IOleWindow;
|
||||
CComPtr<IOleCommandTarget> m_IOleCommandTarget;
|
||||
CComPtr<IInputObject > m_IInputObject;
|
||||
CComPtr<IInputObjectSite > m_IInputObjectSite;
|
||||
CComPtr<IWinEventHandler > m_IWinEventHandler;
|
||||
CComPtr<IServiceProvider > m_IServiceProvider;
|
||||
|
||||
public:
|
||||
// IBandSite
|
||||
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 GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo(BANDSITEINFO *pbsinfo);
|
||||
virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState);
|
||||
|
||||
// IDeskBarClient
|
||||
virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc);
|
||||
virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState);
|
||||
|
||||
// IOleWindow
|
||||
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
|
||||
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
|
||||
|
||||
// IOleCommandTarget
|
||||
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);
|
||||
|
||||
// IInputObject
|
||||
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
|
||||
virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
|
||||
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
|
||||
|
||||
// IInputObjectSite
|
||||
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
|
||||
|
||||
// IWinEventHandler
|
||||
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
||||
|
||||
// IServiceProvider
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
|
||||
|
||||
DECLARE_NOT_AGGREGATABLE(CMenuSiteWrap)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
BEGIN_COM_MAP(CMenuSiteWrap)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
|
||||
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_IWinEventHandler, IWinEventHandler)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
|
||||
END_COM_MAP()
|
||||
};
|
||||
|
||||
extern "C"
|
||||
HRESULT WINAPI CMenuSite_Wrapper(IBandSite * bandSite, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
CMenuSiteWrap * site = new CComObject<CMenuSiteWrap>();
|
||||
|
||||
if (!site)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = site->InitWrap(bandSite);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
{
|
||||
site->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = site->QueryInterface(riid, ppv);
|
||||
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
site->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CMenuSiteWrap::InitWrap(IBandSite * bandSite)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
WrapLogOpen();
|
||||
|
||||
m_IBandSite = bandSite;
|
||||
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &m_IDeskBarClient));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IInputObjectSite, &m_IInputObjectSite));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_IWinEventHandler));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider));
|
||||
return hr;
|
||||
}
|
||||
|
||||
CMenuSiteWrap::~CMenuSiteWrap()
|
||||
{
|
||||
WrapLogClose();
|
||||
}
|
||||
|
||||
// IBandSite
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::AddBand(IUnknown * punk)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::AddBand(IUnknown * punk=%p)\n", this, punk);
|
||||
HRESULT hr = m_IBandSite->AddBand(punk);
|
||||
WrapLogExit("CMenuSiteWrap::AddBand()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::EnumBands(UINT uBand, DWORD* pdwBandID)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::EnumBands(UINT uBand=%u, DWORD* pdwBandID=%p)\n", this, uBand, pdwBandID);
|
||||
HRESULT hr = m_IBandSite->EnumBands(uBand, pdwBandID);
|
||||
if (pdwBandID) WrapLogPost("*pdwBandID=%d\n", *pdwBandID);
|
||||
WrapLogExit("CMenuSiteWrap::EnumBands()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::QueryBand(DWORD dwBandID=%d, IDeskBand **ppstb=%p, DWORD *pdwState=%p, LPWSTR pszName=%p, int cchName=%d)\n", this, dwBandID, ppstb, pdwState, pszName, cchName);
|
||||
HRESULT hr = m_IBandSite->QueryBand(dwBandID, ppstb, pdwState, pszName, cchName);
|
||||
if (ppstb) WrapLogPost("*ppstb=%p\n", *ppstb);
|
||||
if (pdwState) WrapLogPost("*pdwState=%d\n", *pdwState);
|
||||
WrapLogExit("CMenuSiteWrap::QueryBand()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::GetBandObject(DWORD dwBandID=%d, REFIID riid=%s, VOID **ppv=%p)\n", this, dwBandID, Wrap(riid), ppv);
|
||||
HRESULT hr = m_IBandSite->GetBandObject(dwBandID, riid, ppv);
|
||||
if (ppv) WrapLogPost("*ppv=%p\n", *ppv);
|
||||
WrapLogExit("CMenuSiteWrap::GetBandObject()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::GetBandSiteInfo(BANDSITEINFO *pbsinfo)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::GetBandSiteInfo(BANDSITEINFO *pbsinfo=%p)\n", this, pbsinfo);
|
||||
HRESULT hr = m_IBandSite->GetBandSiteInfo(pbsinfo);
|
||||
if (pbsinfo) WrapLogPost("*pbsinfo=%s\n", Wrap(*pbsinfo));
|
||||
WrapLogExit("CMenuSiteWrap::GetBandSiteInfo()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::RemoveBand(DWORD dwBandID)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::RemoveBand(DWORD dwBandID=%d)\n", this, dwBandID);
|
||||
HRESULT hr = m_IBandSite->RemoveBand(dwBandID);
|
||||
WrapLogExit("CMenuSiteWrap::RemoveBand()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::SetBandSiteInfo(const BANDSITEINFO *pbsinfo)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::SetBandSiteInfo(const BANDSITEINFO *pbsinfo=%p)\n", this, pbsinfo);
|
||||
//if (phwnd) WrapLogPost("*pbsinfo=%s\n", Wrap(*pbsinfo));
|
||||
HRESULT hr = m_IBandSite->SetBandSiteInfo(pbsinfo);
|
||||
WrapLogExit("CMenuSiteWrap::SetBandSiteInfo()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::SetBandState(DWORD dwBandID=%d, DWORD dwMask=%08x, DWORD dwState=%d)\n", this, dwBandID, dwMask, dwState);
|
||||
HRESULT hr = m_IBandSite->SetBandState(dwBandID, dwMask, dwState);
|
||||
WrapLogExit("CMenuSiteWrap::SetBandState()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IDeskBarClient ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::SetDeskBarSite(IUnknown *punkSite)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::SetDeskBarSite(IUnknown *punkSite=%p)\n", this, punkSite);
|
||||
HRESULT hr = m_IDeskBarClient->SetDeskBarSite(punkSite);
|
||||
WrapLogExit("CMenuSiteWrap::SetDeskBarSite()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::SetModeDBC(DWORD dwMode)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::SetModeDBC(DWORD dwMode=%d)\n", this, dwMode);
|
||||
HRESULT hr = m_IDeskBarClient->SetModeDBC(dwMode);
|
||||
WrapLogExit("CMenuSiteWrap::SetModeDBC()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::GetSize(DWORD dwWhich, LPRECT prc)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::GetSize(DWORD dwWhich=%d, LPRECT prc=%p)\n", this, dwWhich, prc);
|
||||
HRESULT hr = m_IDeskBarClient->GetSize(dwWhich, prc);
|
||||
if (prc) WrapLogPost("*prc=%s\n", Wrap(*prc));
|
||||
WrapLogExit("CMenuSiteWrap::GetSize()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::UIActivateDBC(DWORD dwState)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::UIActivateDBC(DWORD dwState=%d)\n", this, dwState);
|
||||
HRESULT hr = m_IDeskBarClient->UIActivateDBC(dwState);
|
||||
WrapLogExit("CMenuSiteWrap::UIActivateDBC()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::GetWindow(HWND *phwnd)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd);
|
||||
HRESULT hr = m_IOleWindow->GetWindow(phwnd);
|
||||
if (phwnd) WrapLogPost("*phwnd=%p\n", *phwnd);
|
||||
WrapLogExit("CMenuSiteWrap::GetWindow()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::ContextSensitiveHelp(BOOL fEnterMode)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode);
|
||||
HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode);
|
||||
WrapLogExit("CMenuSiteWrap::ContextSensitiveHelp()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleCommandTarget methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::QueryStatus(const GUID *pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
HRESULT hr = m_IOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
if (pguidCmdGroup) WrapLogPost("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
WrapLogExit("CMenuSiteWrap::QueryStatus()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::Exec(const GUID *pguidCmdGroup=%p, DWORD nCmdID=%d, DWORD nCmdexecopt=%d, VARIANT *pvaIn=%p, VARIANT *pvaOut=%p)\n", this, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
if (pguidCmdGroup) WrapLogPre("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
WrapLogExit("CMenuSiteWrap::Exec()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObject methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::UIActivateIO(BOOL fActivate=%d, LPMSG lpMsg=%p)\n", this, fActivate, lpMsg);
|
||||
HRESULT hr = m_IInputObject->UIActivateIO(fActivate, lpMsg);
|
||||
WrapLogExit("CMenuSiteWrap::UIActivateIO()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::HasFocusIO()
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::HasFocusIO()\n", this);
|
||||
HRESULT hr = m_IInputObject->HasFocusIO();
|
||||
WrapLogExit("CMenuSiteWrap::HasFocusIO()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::TranslateAcceleratorIO(LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg);
|
||||
if (lpMsg) WrapLogPre("*lpMsg=%s\n", Wrap(*lpMsg));
|
||||
HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg);
|
||||
WrapLogExit("CMenuSiteWrap::TranslateAcceleratorIO()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObjectSite methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::OnFocusChangeIS(LPUNKNOWN lpUnknown=%p, BOOL bFocus=%d)\n", this, lpUnknown, bFocus);
|
||||
HRESULT hr = m_IInputObjectSite->OnFocusChangeIS(lpUnknown, bFocus);
|
||||
WrapLogExit("CMenuSiteWrap::OnFocusChangeIS()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IWinEventHandler methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
|
||||
{
|
||||
//WrapLogEnter("CMenuSiteWrap<%p>::OnWinEvent(HWND hWnd=%p, UINT uMsg=%u, WPARAM wParam=%08x, LPARAM lParam=%08x, LRESULT *theResult=%p)\n", this, hWnd, uMsg, wParam, lParam, theResult);
|
||||
HRESULT hr = m_IWinEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
|
||||
//WrapLogExit("CMenuSiteWrap::OnWinEvent()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::IsWindowOwner(HWND hWnd)
|
||||
{
|
||||
//WrapLogEnter("CMenuSiteWrap<%p>::IsWindowOwner(HWND hWnd=%08x)\n", this, hWnd);
|
||||
HRESULT hr = m_IWinEventHandler->IsWindowOwner(hWnd);
|
||||
//WrapLogExit("CMenuSiteWrap::IsWindowOwner()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject);
|
||||
HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject);
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuSiteWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
|
@ -1,190 +0,0 @@
|
|||
/*
|
||||
* Shell Menu Site
|
||||
*
|
||||
* Copyright 2014 David Quintana
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "wraplog.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(menusite);
|
||||
|
||||
class CStartMenuSiteWrap :
|
||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||
public IServiceProvider,
|
||||
public ITrayPriv,
|
||||
public IOleWindow,
|
||||
public IOleCommandTarget
|
||||
{
|
||||
public:
|
||||
CStartMenuSiteWrap() {}
|
||||
~CStartMenuSiteWrap();
|
||||
|
||||
HRESULT InitWrap(ITrayPriv * bandSite);
|
||||
|
||||
private:
|
||||
CComPtr<IServiceProvider > m_IServiceProvider;
|
||||
CComPtr<ITrayPriv > m_ITrayPriv;
|
||||
CComPtr<IOleWindow > m_IOleWindow;
|
||||
CComPtr<IOleCommandTarget> m_IOleCommandTarget;
|
||||
|
||||
public:
|
||||
// IServiceProvider
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
|
||||
|
||||
// ITrayPriv
|
||||
virtual HRESULT STDMETHODCALLTYPE Execute(THIS_ IShellFolder*, LPCITEMIDLIST);
|
||||
virtual HRESULT STDMETHODCALLTYPE Unknown(THIS_ PVOID, PVOID, PVOID, PVOID);
|
||||
virtual HRESULT STDMETHODCALLTYPE AppendMenu(THIS_ HMENU*);
|
||||
|
||||
// IOleWindow
|
||||
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
|
||||
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
|
||||
|
||||
// IOleCommandTarget
|
||||
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);
|
||||
|
||||
DECLARE_NOT_AGGREGATABLE(CStartMenuSiteWrap)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
BEGIN_COM_MAP(CStartMenuSiteWrap)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
|
||||
COM_INTERFACE_ENTRY_IID(IID_ITrayPriv, ITrayPriv)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
|
||||
END_COM_MAP()
|
||||
};
|
||||
|
||||
extern "C"
|
||||
HRESULT WINAPI CStartMenuSite_Wrapper(ITrayPriv * trayPriv, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
CStartMenuSiteWrap * site = new CComObject<CStartMenuSiteWrap>();
|
||||
|
||||
if (!site)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = site->InitWrap(trayPriv);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
{
|
||||
site->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = site->QueryInterface(riid, ppv);
|
||||
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
site->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CStartMenuSiteWrap::InitWrap(ITrayPriv * bandSite)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
WrapLogOpen();
|
||||
|
||||
m_ITrayPriv = bandSite;
|
||||
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
|
||||
if (FAILED_UNEXPECTEDLY(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget));
|
||||
return hr;
|
||||
}
|
||||
|
||||
CStartMenuSiteWrap::~CStartMenuSiteWrap()
|
||||
{
|
||||
WrapLogClose();
|
||||
}
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
||||
{
|
||||
WrapLogEnter("CStartMenuSiteWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject);
|
||||
HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject);
|
||||
if (ppvObject) WrapLogPost("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CStartMenuSiteWrap::QueryService()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** ITrayPriv methods ***
|
||||
HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::Execute(IShellFolder* psf, LPCITEMIDLIST pidl)
|
||||
{
|
||||
WrapLogEnter("CStartMenuSiteWrap<%p>::Execute(IShellFolder* psf=%p, LPCITEMIDLIST pidl=%p)\n", this, psf, pidl);
|
||||
HRESULT hr = m_ITrayPriv->Execute(psf, pidl);
|
||||
WrapLogExit("CStartMenuSiteWrap::Execute()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::Unknown(PVOID unk1, PVOID unk2, PVOID unk3, PVOID unk4)
|
||||
{
|
||||
WrapLogEnter("CStartMenuSiteWrap<%p>::Unknown(PVOID unk1=%p, PVOID unk2=%p, PVOID unk3=%p, PVOID unk4=%p)\n", this, unk1, unk2, unk3, unk4);
|
||||
HRESULT hr = m_ITrayPriv->Unknown(unk1, unk2, unk3, unk4);
|
||||
WrapLogExit("CStartMenuSiteWrap::Unknown()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::AppendMenu(HMENU * phmenu)
|
||||
{
|
||||
WrapLogEnter("CStartMenuSiteWrap<%p>::AppendMenu(HMENU * phmenu=%p)\n", this, phmenu);
|
||||
HRESULT hr = m_ITrayPriv->AppendMenu(phmenu);
|
||||
WrapLogExit("CStartMenuSiteWrap::AppendMenu()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::GetWindow(HWND *phwnd)
|
||||
{
|
||||
WrapLogEnter("CStartMenuSiteWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd);
|
||||
HRESULT hr = m_IOleWindow->GetWindow(phwnd);
|
||||
if (phwnd) WrapLogPost("*phwnd=%p\n", *phwnd);
|
||||
WrapLogExit("CStartMenuSiteWrap::GetWindow()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::ContextSensitiveHelp(BOOL fEnterMode)
|
||||
{
|
||||
WrapLogEnter("CStartMenuSiteWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode);
|
||||
HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode);
|
||||
WrapLogExit("CStartMenuSiteWrap::ContextSensitiveHelp()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleCommandTarget methods ***
|
||||
HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
|
||||
{
|
||||
WrapLogEnter("CStartMenuSiteWrap<%p>::QueryStatus(const GUID *pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
HRESULT hr = m_IOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
if (pguidCmdGroup) WrapLogPost("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
WrapLogExit("CStartMenuSiteWrap::QueryStatus()", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CStartMenuSiteWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
{
|
||||
WrapLogEnter("CStartMenuSiteWrap<%p>::Exec(const GUID *pguidCmdGroup=%p, DWORD nCmdID=%d, DWORD nCmdexecopt=%d, VARIANT *pvaIn=%p, VARIANT *pvaOut=%p)\n", this, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
if (pguidCmdGroup) WrapLogPre("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
WrapLogExit("CStartMenuSiteWrap::Exec()", hr);
|
||||
return hr;
|
||||
}
|
|
@ -1,159 +0,0 @@
|
|||
#include "precomp.h"
|
||||
#include "wraplog.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static INT openCount = 0;
|
||||
static INT callLevel;
|
||||
static FILE*log;
|
||||
|
||||
static INT nTemps;
|
||||
static CHAR strTemp[10][256];
|
||||
|
||||
void WrapLogOpen()
|
||||
{
|
||||
if (openCount == 0)
|
||||
{
|
||||
log = fopen("C:\\RShellWrap.log", "w");
|
||||
nTemps = 0;
|
||||
callLevel = 0;
|
||||
}
|
||||
openCount++;
|
||||
}
|
||||
|
||||
void WrapLogClose()
|
||||
{
|
||||
openCount--;
|
||||
if (openCount == 0)
|
||||
{
|
||||
fclose(log);
|
||||
log = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void __cdecl WrapLogPrint(_Printf_format_string_ const char* msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
for (int i = 0; i < callLevel; i++)
|
||||
fputs(" ", log);
|
||||
va_start(args, msg);
|
||||
vfprintf(log, msg, args);
|
||||
va_end(args);
|
||||
fflush(log);
|
||||
nTemps = 0;
|
||||
}
|
||||
|
||||
void __cdecl WrapLogPre(_Printf_format_string_ const char* msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
for (int i = 0; i < callLevel; i++)
|
||||
fputs(" ", log);
|
||||
fputs("pre: ", log);
|
||||
va_start(args, msg);
|
||||
vfprintf(log, msg, args);
|
||||
va_end(args);
|
||||
fflush(log);
|
||||
nTemps = 0;
|
||||
}
|
||||
|
||||
void __cdecl WrapLogPost(_Printf_format_string_ const char* msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
for (int i = 0; i < callLevel; i++)
|
||||
fputs(" ", log);
|
||||
fputs("post: ", log);
|
||||
va_start(args, msg);
|
||||
vfprintf(log, msg, args);
|
||||
va_end(args);
|
||||
fflush(log);
|
||||
nTemps = 0;
|
||||
}
|
||||
|
||||
void __cdecl WrapLogEnter(_Printf_format_string_ const char* msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
for (int i = 0; i < callLevel; i++)
|
||||
fputs(" ", log);
|
||||
fputs("CALL ", log);
|
||||
va_start(args, msg);
|
||||
vfprintf(log, msg, args);
|
||||
va_end(args);
|
||||
fflush(log);
|
||||
callLevel++;
|
||||
nTemps = 0;
|
||||
}
|
||||
|
||||
void __cdecl WrapLogExit(const char* msg, HRESULT code)
|
||||
{
|
||||
//if (FAILED(code))
|
||||
// WrapLogPrint("RETURN %s = %08x\n", msg, code);
|
||||
//else if (code == S_OK)
|
||||
// WrapLogPrint("RETURN %s = S_OK\n", msg);
|
||||
//else if (code == S_FALSE)
|
||||
// WrapLogPrint("RETURN %s = S_FALSE\n", msg);
|
||||
//else
|
||||
// WrapLogPrint("RETURN %s = %d\n", msg, code);
|
||||
if (FAILED(code))
|
||||
WrapLogPrint("RETURN %08x\n", code);
|
||||
else if (code == S_OK)
|
||||
WrapLogPrint("RETURN S_OK\n");
|
||||
else if (code == S_FALSE)
|
||||
WrapLogPrint("RETURN S_FALSE\n");
|
||||
else
|
||||
WrapLogPrint("RETURN %d\n", code);
|
||||
callLevel--;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
LPSTR Wrap(const T& value);
|
||||
|
||||
template <>
|
||||
LPSTR Wrap<GUID>(REFGUID guid)
|
||||
{
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
|
||||
guid.Data1, guid.Data2, guid.Data3,
|
||||
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
|
||||
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
|
||||
return cStr;
|
||||
}
|
||||
|
||||
template <>
|
||||
LPSTR Wrap<RECT>(const RECT& rect)
|
||||
{
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{L: %d, T: %d, R: %d, B: %d}",
|
||||
rect.left, rect.top, rect.right, rect.bottom);
|
||||
return cStr;
|
||||
}
|
||||
|
||||
template <>
|
||||
LPSTR Wrap<OLECMD>(const OLECMD& cmd)
|
||||
{
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{ID: %d, F: %d}",
|
||||
cmd.cmdID, cmd.cmdf);
|
||||
return cStr;
|
||||
}
|
||||
|
||||
template <>
|
||||
LPSTR Wrap<MSG>(const MSG& msg)
|
||||
{
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{HWND: %d, Code: %d, W: %p, L: %p, T: %d, P.X: %d, P.Y: %d}",
|
||||
msg.hwnd, msg.message, msg.wParam, msg.lParam, msg.time, msg.pt.x, msg.pt.y);
|
||||
return cStr;
|
||||
}
|
||||
|
||||
template <>
|
||||
LPSTR Wrap<BANDSITEINFO>(const BANDSITEINFO& bsi)
|
||||
{
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{dwMask: %08x, dwState: %08x, dwStyle: %08x}",
|
||||
bsi.dwMask, bsi.dwState, bsi.dwStyle);
|
||||
return cStr;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
void WrapLogOpen();
|
||||
void WrapLogClose();
|
||||
void __cdecl WrapLogPre(_Printf_format_string_ const char* msg, ...);
|
||||
void __cdecl WrapLogPost(_Printf_format_string_ const char* msg, ...);
|
||||
void __cdecl WrapLogEnter(_Printf_format_string_ const char* msg, ...);
|
||||
void __cdecl WrapLogExit(const char* msg, HRESULT code);
|
||||
|
||||
template <class T>
|
||||
LPSTR Wrap(const T& value);
|
Loading…
Add table
Add a link
Reference in a new issue