2014-02-24 11:59:34 +00:00
|
|
|
/*
|
|
|
|
* 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 <windowsx.h>
|
2014-03-20 15:39:25 +00:00
|
|
|
#include <commoncontrols.h>
|
2014-02-24 11:59:34 +00:00
|
|
|
#include <shlwapi_undoc.h>
|
|
|
|
|
|
|
|
#include "CMenuFocusManager.h"
|
2014-03-19 15:33:41 +00:00
|
|
|
#include "CMenuToolbars.h"
|
2014-02-24 11:59:34 +00:00
|
|
|
#include "CMenuBand.h"
|
|
|
|
|
2014-04-09 11:45:02 +00:00
|
|
|
#if DBG
|
|
|
|
# undef _ASSERT
|
|
|
|
# define _ASSERT(x) DbgAssert(!!(x), __FILE__, __LINE__, #x)
|
2014-03-26 11:33:52 +00:00
|
|
|
|
|
|
|
bool DbgAssert(bool x, const char * filename, int line, const char * expr)
|
|
|
|
{
|
|
|
|
if (!x)
|
|
|
|
{
|
|
|
|
char szMsg[512];
|
|
|
|
const char *fname;
|
|
|
|
|
|
|
|
fname = strrchr(filename, '\\');
|
|
|
|
if (fname == NULL)
|
|
|
|
{
|
|
|
|
fname = strrchr(filename, '/');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fname == NULL)
|
|
|
|
fname = filename;
|
|
|
|
else
|
|
|
|
fname++;
|
|
|
|
|
|
|
|
sprintf(szMsg, "%s:%d: Assertion failed: %s\n", fname, line, expr);
|
|
|
|
|
|
|
|
OutputDebugStringA(szMsg);
|
|
|
|
|
|
|
|
__debugbreak();
|
|
|
|
}
|
|
|
|
return x;
|
|
|
|
}
|
2014-04-09 11:45:02 +00:00
|
|
|
#else
|
|
|
|
# undef _ASSERT
|
|
|
|
# define _ASSERT(x) (!!(x))
|
|
|
|
#endif
|
2014-03-26 11:33:52 +00:00
|
|
|
|
2014-02-24 11:59:34 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(CMenuFocus);
|
|
|
|
|
|
|
|
DWORD CMenuFocusManager::TlsIndex = 0;
|
|
|
|
|
|
|
|
CMenuFocusManager * CMenuFocusManager::GetManager()
|
|
|
|
{
|
|
|
|
return reinterpret_cast<CMenuFocusManager *>(TlsGetValue(TlsIndex));
|
|
|
|
}
|
|
|
|
|
|
|
|
CMenuFocusManager * CMenuFocusManager::AcquireManager()
|
|
|
|
{
|
|
|
|
CMenuFocusManager * obj = NULL;
|
|
|
|
|
|
|
|
if (!TlsIndex)
|
|
|
|
{
|
|
|
|
if ((TlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES)
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
obj = GetManager();
|
|
|
|
|
|
|
|
if (!obj)
|
|
|
|
{
|
|
|
|
obj = new CComObject<CMenuFocusManager>();
|
|
|
|
TlsSetValue(TlsIndex, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
obj->AddRef();
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMenuFocusManager::ReleaseManager(CMenuFocusManager * obj)
|
|
|
|
{
|
|
|
|
if (!obj->Release())
|
|
|
|
{
|
|
|
|
TlsSetValue(TlsIndex, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-19 15:33:41 +00:00
|
|
|
LRESULT CALLBACK CMenuFocusManager::s_MsgFilterHook(INT nCode, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
return GetManager()->MsgFilterHook(nCode, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
2014-02-24 11:59:34 +00:00
|
|
|
LRESULT CALLBACK CMenuFocusManager::s_GetMsgHook(INT nCode, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
return GetManager()->GetMsgHook(nCode, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT CMenuFocusManager::PushToArray(StackEntryType type, CMenuBand * mb, HMENU hmenu)
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
|
|
|
if (m_bandCount >= MAX_RECURSE)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
m_bandStack[m_bandCount].type = type;
|
|
|
|
m_bandStack[m_bandCount].mb = mb;
|
|
|
|
m_bandStack[m_bandCount].hmenu = hmenu;
|
|
|
|
m_bandCount++;
|
2014-02-24 11:59:34 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT CMenuFocusManager::PopFromArray(StackEntryType * pType, CMenuBand ** pMb, HMENU * pHmenu)
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
if (pType) *pType = NoEntry;
|
|
|
|
if (pMb) *pMb = NULL;
|
|
|
|
if (pHmenu) *pHmenu = NULL;
|
2014-02-24 11:59:34 +00:00
|
|
|
|
|
|
|
if (m_bandCount <= 0)
|
2014-03-16 09:28:51 +00:00
|
|
|
return S_FALSE;
|
2014-02-24 11:59:34 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
m_bandCount--;
|
2014-02-24 11:59:34 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
if (pType) *pType = m_bandStack[m_bandCount].type;
|
|
|
|
if (*pType == TrackedMenuEntry)
|
|
|
|
{
|
|
|
|
if (pHmenu) *pHmenu = m_bandStack[m_bandCount].hmenu;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pMb) *pMb = m_bandStack[m_bandCount].mb;
|
|
|
|
}
|
|
|
|
|
2014-02-24 11:59:34 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
CMenuFocusManager::CMenuFocusManager() :
|
2014-03-26 11:33:52 +00:00
|
|
|
m_current(NULL),
|
|
|
|
m_parent(NULL),
|
2014-03-19 15:33:41 +00:00
|
|
|
m_hMsgFilterHook(NULL),
|
|
|
|
m_hGetMsgHook(NULL),
|
2014-03-15 21:38:15 +00:00
|
|
|
m_mouseTrackDisabled(FALSE),
|
2014-03-26 11:33:52 +00:00
|
|
|
m_captureHwnd(0),
|
2014-04-03 18:30:25 +00:00
|
|
|
m_hwndUnderMouse(NULL),
|
|
|
|
m_entryUnderMouse(NULL),
|
2014-04-15 22:30:37 +00:00
|
|
|
m_selectedMenu(NULL),
|
|
|
|
m_selectedItem(0),
|
|
|
|
m_selectedItemFlags(0),
|
2014-03-16 09:28:51 +00:00
|
|
|
m_bandCount(0)
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
m_ptPrev.x = 0;
|
|
|
|
m_ptPrev.y = 0;
|
2014-02-24 11:59:34 +00:00
|
|
|
m_threadId = GetCurrentThreadId();
|
|
|
|
}
|
|
|
|
|
|
|
|
CMenuFocusManager::~CMenuFocusManager()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
void CMenuFocusManager::DisableMouseTrack(HWND parent, BOOL disableThis)
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
|
|
|
BOOL bDisable = FALSE;
|
2014-03-26 11:33:52 +00:00
|
|
|
BOOL lastDisable = FALSE;
|
2014-03-15 21:38:15 +00:00
|
|
|
|
|
|
|
int i = m_bandCount;
|
|
|
|
while (--i >= 0)
|
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
StackEntry& entry = m_bandStack[i];
|
2014-03-15 21:38:15 +00:00
|
|
|
|
2014-04-02 17:37:37 +00:00
|
|
|
if (entry.type != TrackedMenuEntry)
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
HWND hwnd;
|
|
|
|
HRESULT hr = entry.mb->_GetTopLevelWindow(&hwnd);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (hwnd == parent)
|
|
|
|
{
|
|
|
|
lastDisable = disableThis;
|
|
|
|
entry.mb->_DisableMouseTrack(disableThis);
|
|
|
|
bDisable = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lastDisable = bDisable;
|
|
|
|
entry.mb->_DisableMouseTrack(bDisable);
|
|
|
|
}
|
2014-03-15 21:38:15 +00:00
|
|
|
}
|
|
|
|
}
|
2014-03-26 11:33:52 +00:00
|
|
|
m_mouseTrackDisabled = lastDisable;
|
|
|
|
}
|
2014-03-15 21:38:15 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
void CMenuFocusManager::SetCapture(HWND child)
|
|
|
|
{
|
|
|
|
if (m_captureHwnd != child)
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
if (child)
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
::SetCapture(child);
|
|
|
|
m_captureHwnd = child;
|
2014-05-18 14:20:27 +00:00
|
|
|
TRACE("MouseTrack is now capturing %p\n", child);
|
2014-03-15 21:38:15 +00:00
|
|
|
}
|
|
|
|
else
|
2014-03-26 11:33:52 +00:00
|
|
|
{
|
|
|
|
::ReleaseCapture();
|
|
|
|
m_captureHwnd = NULL;
|
2014-05-18 14:20:27 +00:00
|
|
|
TRACE("MouseTrack is now off\n");
|
2014-03-26 11:33:52 +00:00
|
|
|
}
|
2014-03-15 21:38:15 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-02 17:37:37 +00:00
|
|
|
HRESULT CMenuFocusManager::IsTrackedWindow(HWND hWnd, StackEntry ** pentry)
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
2014-04-02 17:37:37 +00:00
|
|
|
if (pentry)
|
|
|
|
*pentry = NULL;
|
|
|
|
|
|
|
|
for (int i = m_bandCount; --i >= 0;)
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
StackEntry& entry = m_bandStack[i];
|
2014-03-15 21:38:15 +00:00
|
|
|
|
2014-04-02 17:37:37 +00:00
|
|
|
if (entry.type != TrackedMenuEntry)
|
2014-03-21 10:13:18 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT hr = entry.mb->IsWindowOwner(hWnd);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
if (hr == S_OK)
|
2014-04-02 17:37:37 +00:00
|
|
|
{
|
|
|
|
if (pentry)
|
|
|
|
*pentry = &entry;
|
2014-03-26 11:33:52 +00:00
|
|
|
return S_OK;
|
2014-04-02 17:37:37 +00:00
|
|
|
}
|
2014-03-21 10:13:18 +00:00
|
|
|
}
|
2014-03-15 21:38:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-05-16 11:12:51 +00:00
|
|
|
HRESULT CMenuFocusManager::IsTrackedWindowOrParent(HWND hWnd)
|
|
|
|
{
|
|
|
|
for (int i = m_bandCount; --i >= 0;)
|
|
|
|
{
|
|
|
|
StackEntry& entry = m_bandStack[i];
|
|
|
|
|
|
|
|
if (entry.type != TrackedMenuEntry)
|
|
|
|
{
|
|
|
|
HRESULT hr = entry.mb->IsWindowOwner(hWnd);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
if (hr == S_OK)
|
|
|
|
return S_OK;
|
|
|
|
if (entry.mb->_IsPopup() == S_OK)
|
|
|
|
{
|
|
|
|
CComPtr<IUnknown> site;
|
|
|
|
CComPtr<IOleWindow> pw;
|
|
|
|
hr = entry.mb->GetSite(IID_PPV_ARG(IUnknown, &site));
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
continue;
|
|
|
|
hr = IUnknown_QueryService(site, SID_SMenuBandParent, IID_PPV_ARG(IOleWindow, &pw));
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
HWND hParent;
|
|
|
|
if (pw->GetWindow(&hParent) == S_OK && hParent == hWnd)
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-03-20 15:39:25 +00:00
|
|
|
LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
2014-03-19 15:33:41 +00:00
|
|
|
{
|
|
|
|
HWND child;
|
2014-04-09 11:45:02 +00:00
|
|
|
int iHitTestResult = -1;
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-04-02 17:37:37 +00:00
|
|
|
POINT pt2 = { GET_X_LPARAM(msg->lParam), GET_Y_LPARAM(msg->lParam) };
|
|
|
|
ClientToScreen(msg->hwnd, &pt2);
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-04-07 10:12:41 +00:00
|
|
|
// Don't do anything if the mouse has not been moved
|
2014-04-02 17:37:37 +00:00
|
|
|
POINT pt = msg->pt;
|
|
|
|
if (pt.x == m_ptPrev.x && pt.y == m_ptPrev.y)
|
2014-03-20 15:39:25 +00:00
|
|
|
return TRUE;
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-04-07 10:12:41 +00:00
|
|
|
// Don't do anything if another window is capturing the mouse.
|
|
|
|
HWND cCapture = ::GetCapture();
|
2014-04-07 18:41:47 +00:00
|
|
|
if (cCapture && cCapture != m_captureHwnd && m_current->type != TrackedMenuEntry)
|
2014-04-07 10:12:41 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2014-04-02 17:37:37 +00:00
|
|
|
m_ptPrev = pt;
|
|
|
|
|
|
|
|
child = WindowFromPoint(pt);
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-04-03 18:30:25 +00:00
|
|
|
StackEntry * entry = NULL;
|
|
|
|
IsTrackedWindow(child, &entry);
|
|
|
|
|
2014-04-09 11:45:02 +00:00
|
|
|
BOOL isTracking = FALSE;
|
2014-04-03 18:30:25 +00:00
|
|
|
if (entry)
|
2014-03-20 15:39:25 +00:00
|
|
|
{
|
2014-04-02 17:37:37 +00:00
|
|
|
ScreenToClient(child, &pt);
|
|
|
|
iHitTestResult = SendMessageW(child, TB_HITTEST, 0, (LPARAM) &pt);
|
2014-04-09 11:45:02 +00:00
|
|
|
isTracking = entry->mb->_IsTracking();
|
2014-04-02 17:37:37 +00:00
|
|
|
|
2014-04-09 11:45:02 +00:00
|
|
|
if (SendMessage(child, WM_USER_ISTRACKEDITEM, iHitTestResult, 0) == S_FALSE)
|
2014-03-20 15:39:25 +00:00
|
|
|
{
|
2014-05-18 14:20:27 +00:00
|
|
|
TRACE("Hot item tracking detected a change (capture=%p / cCapture=%p)...\n", m_captureHwnd, cCapture);
|
2014-04-02 17:37:37 +00:00
|
|
|
DisableMouseTrack(NULL, FALSE);
|
2014-04-09 11:45:02 +00:00
|
|
|
if (isTracking && iHitTestResult>=0 && m_current->type == TrackedMenuEntry)
|
2014-04-02 17:37:37 +00:00
|
|
|
SendMessage(entry->hwnd, WM_CANCELMODE, 0, 0);
|
2014-04-22 17:44:19 +00:00
|
|
|
PostMessage(child, WM_USER_CHANGETRACKEDITEM, iHitTestResult, MAKELPARAM(isTracking, TRUE));
|
2014-04-07 18:41:47 +00:00
|
|
|
if (m_current->type == TrackedMenuEntry)
|
|
|
|
return FALSE;
|
2014-03-20 15:39:25 +00:00
|
|
|
}
|
2014-04-03 18:30:25 +00:00
|
|
|
}
|
2014-04-02 17:37:37 +00:00
|
|
|
|
2014-04-09 11:45:02 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2014-04-03 18:30:25 +00:00
|
|
|
if (m_hwndUnderMouse != child)
|
|
|
|
{
|
|
|
|
if (entry)
|
2014-04-02 17:37:37 +00:00
|
|
|
{
|
2014-04-09 11:45:02 +00:00
|
|
|
// Mouse moved to a tracked window
|
2014-04-03 18:30:25 +00:00
|
|
|
if (m_current->type == MenuPopupEntry)
|
|
|
|
{
|
|
|
|
ScreenToClient(child, &pt2);
|
|
|
|
SendMessage(child, WM_MOUSEMOVE, msg->wParam, MAKELPARAM(pt2.x, pt2.y));
|
|
|
|
}
|
2014-04-02 17:37:37 +00:00
|
|
|
}
|
2014-04-03 18:30:25 +00:00
|
|
|
|
|
|
|
m_hwndUnderMouse = child;
|
|
|
|
m_entryUnderMouse = entry;
|
2014-04-02 17:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (m_current->type == MenuPopupEntry)
|
|
|
|
{
|
|
|
|
HWND parent = GetAncestor(child, GA_ROOT);
|
|
|
|
DisableMouseTrack(parent, FALSE);
|
2014-03-20 15:39:25 +00:00
|
|
|
}
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-03-20 15:39:25 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-04-16 12:14:02 +00:00
|
|
|
LRESULT CMenuFocusManager::MsgFilterHook(INT nCode, WPARAM hookWParam, LPARAM hookLParam)
|
2014-03-20 15:39:25 +00:00
|
|
|
{
|
|
|
|
if (nCode < 0)
|
2014-04-16 12:14:02 +00:00
|
|
|
return CallNextHookEx(m_hMsgFilterHook, nCode, hookWParam, hookLParam);
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-03-20 15:39:25 +00:00
|
|
|
if (nCode == MSGF_MENU)
|
|
|
|
{
|
|
|
|
BOOL callNext = TRUE;
|
2014-04-16 12:14:02 +00:00
|
|
|
MSG* msg = reinterpret_cast<MSG*>(hookLParam);
|
2014-04-02 17:37:37 +00:00
|
|
|
|
2014-03-20 15:39:25 +00:00
|
|
|
switch (msg->message)
|
|
|
|
{
|
2014-04-02 17:37:37 +00:00
|
|
|
case WM_NCLBUTTONDOWN:
|
|
|
|
case WM_LBUTTONDOWN:
|
2014-05-26 12:26:47 +00:00
|
|
|
case WM_NCRBUTTONDOWN:
|
|
|
|
case WM_RBUTTONDOWN:
|
2014-04-02 17:37:37 +00:00
|
|
|
if (m_menuBar)
|
|
|
|
{
|
|
|
|
POINT pt = msg->pt;
|
|
|
|
HWND child = WindowFromPoint(pt);
|
|
|
|
BOOL hoveringMenuBar = m_menuBar->mb->IsWindowOwner(child) == S_OK;
|
|
|
|
if (hoveringMenuBar)
|
|
|
|
{
|
|
|
|
m_menuBar->mb->_DisableMouseTrack(TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2014-03-20 15:39:25 +00:00
|
|
|
case WM_MOUSEMOVE:
|
|
|
|
callNext = ProcessMouseMove(msg);
|
2014-03-19 15:33:41 +00:00
|
|
|
break;
|
2014-04-15 22:30:37 +00:00
|
|
|
case WM_INITMENUPOPUP:
|
2014-05-18 14:20:27 +00:00
|
|
|
TRACE("WM_INITMENUPOPUP %p %p\n", msg->wParam, msg->lParam);
|
2014-04-16 12:14:02 +00:00
|
|
|
m_selectedMenu = reinterpret_cast<HMENU>(msg->lParam);
|
2014-04-15 22:30:37 +00:00
|
|
|
m_selectedItem = -1;
|
|
|
|
m_selectedItemFlags = 0;
|
|
|
|
break;
|
|
|
|
case WM_MENUSELECT:
|
2014-05-18 14:20:27 +00:00
|
|
|
TRACE("WM_MENUSELECT %p %p\n", msg->wParam, msg->lParam);
|
2014-04-16 12:14:02 +00:00
|
|
|
m_selectedMenu = reinterpret_cast<HMENU>(msg->lParam);
|
|
|
|
m_selectedItem = GET_X_LPARAM(msg->wParam);
|
|
|
|
m_selectedItemFlags = HIWORD(msg->wParam);
|
2014-04-15 22:30:37 +00:00
|
|
|
break;
|
|
|
|
case WM_KEYDOWN:
|
|
|
|
switch (msg->wParam)
|
|
|
|
{
|
|
|
|
case VK_LEFT:
|
|
|
|
if (m_current->hmenu == m_selectedMenu)
|
|
|
|
{
|
|
|
|
m_parent->mb->_MenuItemHotTrack(VK_LEFT);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VK_RIGHT:
|
2014-04-16 12:14:02 +00:00
|
|
|
if (m_selectedItem < 0 || !(m_selectedItemFlags & MF_POPUP))
|
2014-04-15 22:30:37 +00:00
|
|
|
{
|
|
|
|
m_parent->mb->_MenuItemHotTrack(VK_RIGHT);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2014-03-19 15:33:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!callNext)
|
2014-04-02 17:37:37 +00:00
|
|
|
return 1;
|
2014-03-19 15:33:41 +00:00
|
|
|
}
|
|
|
|
|
2014-04-16 12:14:02 +00:00
|
|
|
return CallNextHookEx(m_hMsgFilterHook, nCode, hookWParam, hookLParam);
|
2014-03-19 15:33:41 +00:00
|
|
|
}
|
|
|
|
|
2014-04-16 12:14:02 +00:00
|
|
|
LRESULT CMenuFocusManager::GetMsgHook(INT nCode, WPARAM hookWParam, LPARAM hookLParam)
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
|
|
|
if (nCode < 0)
|
2014-04-16 12:14:02 +00:00
|
|
|
return CallNextHookEx(m_hGetMsgHook, nCode, hookWParam, hookLParam);
|
2014-04-02 17:37:37 +00:00
|
|
|
|
2014-02-24 11:59:34 +00:00
|
|
|
if (nCode == HC_ACTION)
|
|
|
|
{
|
|
|
|
BOOL callNext = TRUE;
|
2014-04-16 12:14:02 +00:00
|
|
|
MSG* msg = reinterpret_cast<MSG*>(hookLParam);
|
2014-04-02 17:37:37 +00:00
|
|
|
POINT pt = msg->pt;
|
2014-04-03 18:30:25 +00:00
|
|
|
|
2014-02-24 11:59:34 +00:00
|
|
|
switch (msg->message)
|
|
|
|
{
|
2014-03-19 15:33:41 +00:00
|
|
|
case WM_NCLBUTTONDOWN:
|
2014-03-17 12:33:03 +00:00
|
|
|
case WM_LBUTTONDOWN:
|
2014-05-26 12:26:47 +00:00
|
|
|
case WM_NCRBUTTONDOWN:
|
|
|
|
case WM_RBUTTONDOWN:
|
2014-03-26 11:33:52 +00:00
|
|
|
if (m_current->type == MenuPopupEntry)
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
HWND child = WindowFromPoint(pt);
|
2014-04-03 18:30:25 +00:00
|
|
|
|
2014-05-16 11:12:51 +00:00
|
|
|
if (IsTrackedWindowOrParent(child) != S_OK)
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
2014-04-02 17:37:37 +00:00
|
|
|
SetCapture(NULL);
|
2014-03-26 11:33:52 +00:00
|
|
|
m_current->mb->_MenuItemHotTrack(MPOS_FULLCANCEL);
|
2014-03-15 21:38:15 +00:00
|
|
|
}
|
2014-03-26 11:33:52 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_MOUSEMOVE:
|
2014-04-02 17:37:37 +00:00
|
|
|
callNext = ProcessMouseMove(msg);
|
2014-03-15 21:38:15 +00:00
|
|
|
break;
|
2014-04-07 18:41:47 +00:00
|
|
|
case WM_MOUSELEAVE:
|
|
|
|
callNext = ProcessMouseMove(msg);
|
|
|
|
//callNext = ProcessMouseLeave(msg);
|
|
|
|
break;
|
2014-02-24 11:59:34 +00:00
|
|
|
case WM_SYSKEYDOWN:
|
|
|
|
case WM_KEYDOWN:
|
2014-04-03 18:30:25 +00:00
|
|
|
if (m_current->type == MenuPopupEntry)
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
2014-04-03 18:30:25 +00:00
|
|
|
DisableMouseTrack(m_current->hwnd, TRUE);
|
|
|
|
switch (msg->wParam)
|
|
|
|
{
|
2014-04-07 18:41:47 +00:00
|
|
|
case VK_ESCAPE:
|
2014-04-03 18:30:25 +00:00
|
|
|
case VK_MENU:
|
|
|
|
case VK_LMENU:
|
|
|
|
case VK_RMENU:
|
|
|
|
m_current->mb->_MenuItemHotTrack(MPOS_FULLCANCEL);
|
|
|
|
break;
|
2014-04-24 11:25:46 +00:00
|
|
|
case VK_RETURN:
|
|
|
|
m_current->mb->_MenuItemHotTrack(MPOS_EXECUTE);
|
|
|
|
break;
|
2014-04-03 18:30:25 +00:00
|
|
|
case VK_LEFT:
|
2014-04-07 18:41:47 +00:00
|
|
|
m_current->mb->_MenuItemHotTrack(VK_LEFT);
|
2014-04-03 18:30:25 +00:00
|
|
|
break;
|
|
|
|
case VK_RIGHT:
|
2014-04-07 18:41:47 +00:00
|
|
|
m_current->mb->_MenuItemHotTrack(VK_RIGHT);
|
2014-04-03 18:30:25 +00:00
|
|
|
break;
|
|
|
|
case VK_UP:
|
|
|
|
m_current->mb->_MenuItemHotTrack(VK_UP);
|
|
|
|
break;
|
|
|
|
case VK_DOWN:
|
|
|
|
m_current->mb->_MenuItemHotTrack(VK_DOWN);
|
|
|
|
break;
|
|
|
|
}
|
2014-04-24 11:25:46 +00:00
|
|
|
msg->message = WM_NULL;
|
|
|
|
msg->lParam = 0;
|
|
|
|
msg->wParam = 0;
|
2014-02-24 11:59:34 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!callNext)
|
2014-04-02 17:37:37 +00:00
|
|
|
return 1;
|
2014-02-24 11:59:34 +00:00
|
|
|
}
|
|
|
|
|
2014-04-16 12:14:02 +00:00
|
|
|
return CallNextHookEx(m_hGetMsgHook, nCode, hookWParam, hookLParam);
|
2014-02-24 11:59:34 +00:00
|
|
|
}
|
|
|
|
|
2014-03-19 15:33:41 +00:00
|
|
|
HRESULT CMenuFocusManager::PlaceHooks()
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
2014-04-02 17:37:37 +00:00
|
|
|
if (m_current->type == TrackedMenuEntry)
|
2014-03-19 15:33:41 +00:00
|
|
|
{
|
2014-05-18 14:20:27 +00:00
|
|
|
TRACE("Entering MSGFILTER hook...\n");
|
2014-03-19 15:33:41 +00:00
|
|
|
m_hMsgFilterHook = SetWindowsHookEx(WH_MSGFILTER, s_MsgFilterHook, NULL, m_threadId);
|
|
|
|
}
|
2014-04-03 18:30:25 +00:00
|
|
|
else
|
2014-03-19 15:33:41 +00:00
|
|
|
{
|
2014-05-18 14:20:27 +00:00
|
|
|
TRACE("Entering GETMESSAGE hook...\n");
|
2014-03-19 15:33:41 +00:00
|
|
|
m_hGetMsgHook = SetWindowsHookEx(WH_GETMESSAGE, s_GetMsgHook, NULL, m_threadId);
|
|
|
|
}
|
2014-02-24 11:59:34 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-03-19 15:33:41 +00:00
|
|
|
HRESULT CMenuFocusManager::RemoveHooks()
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
2014-05-18 14:20:27 +00:00
|
|
|
TRACE("Removing all hooks...\n");
|
2014-03-19 15:33:41 +00:00
|
|
|
if (m_hMsgFilterHook)
|
|
|
|
UnhookWindowsHookEx(m_hMsgFilterHook);
|
|
|
|
if (m_hGetMsgHook)
|
|
|
|
UnhookWindowsHookEx(m_hGetMsgHook);
|
|
|
|
m_hMsgFilterHook = NULL;
|
|
|
|
m_hGetMsgHook = NULL;
|
2014-02-24 11:59:34 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT CMenuFocusManager::UpdateFocus()
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
2014-03-26 11:33:52 +00:00
|
|
|
StackEntry * old = m_current;
|
|
|
|
|
|
|
|
if (old)
|
|
|
|
SetCapture(NULL);
|
2014-03-15 21:38:15 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
if (m_bandCount > 0)
|
|
|
|
m_current = &(m_bandStack[m_bandCount - 1]);
|
|
|
|
else
|
|
|
|
m_current = NULL;
|
|
|
|
|
|
|
|
if (m_current && m_current->type != TrackedMenuEntry)
|
2014-03-15 21:38:15 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
hr = m_current->mb->_GetTopLevelWindow(&(m_current->hwnd));
|
2014-03-15 21:38:15 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
if (m_bandCount >= 2)
|
2014-03-19 15:33:41 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
m_parent = &(m_bandStack[m_bandCount - 2]);
|
|
|
|
_ASSERT(m_parent->type != TrackedMenuEntry);
|
2014-03-19 15:33:41 +00:00
|
|
|
}
|
2014-03-26 11:33:52 +00:00
|
|
|
else
|
2014-03-20 15:39:25 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
m_parent = NULL;
|
2014-03-20 15:39:25 +00:00
|
|
|
}
|
2014-02-24 11:59:34 +00:00
|
|
|
|
2014-04-02 17:37:37 +00:00
|
|
|
if (m_bandCount >= 1 && m_bandStack[0].type == MenuBarEntry)
|
|
|
|
{
|
|
|
|
m_menuBar = &(m_bandStack[0]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_menuBar = NULL;
|
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
if (old && (!m_current || old->type != m_current->type))
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
2014-04-03 18:30:25 +00:00
|
|
|
if (m_current && m_current->type != TrackedMenuEntry)
|
2014-04-02 17:37:37 +00:00
|
|
|
{
|
|
|
|
DisableMouseTrack(m_current->hwnd, FALSE);
|
|
|
|
}
|
2014-03-16 09:28:51 +00:00
|
|
|
|
2014-03-19 15:33:41 +00:00
|
|
|
hr = RemoveHooks();
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
2014-02-24 11:59:34 +00:00
|
|
|
}
|
2014-03-26 11:33:52 +00:00
|
|
|
|
|
|
|
if (m_current && (!old || old->type != m_current->type))
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
2014-03-19 15:33:41 +00:00
|
|
|
hr = PlaceHooks();
|
2014-03-03 16:11:47 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-02-24 11:59:34 +00:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2014-04-02 17:37:37 +00:00
|
|
|
if (m_parent)
|
|
|
|
{
|
|
|
|
DisableMouseTrack(m_parent->hwnd, TRUE);
|
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
if ((m_current && m_current->type == MenuPopupEntry) &&
|
|
|
|
(!m_parent || m_parent->type == MenuBarEntry))
|
|
|
|
{
|
|
|
|
// When the mouse moves, it should set itself to the proper band
|
|
|
|
SetCapture(m_current->hwnd);
|
2014-04-02 17:37:37 +00:00
|
|
|
|
2014-04-09 11:45:02 +00:00
|
|
|
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);
|
|
|
|
}
|
2014-03-26 11:33:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_ASSERT(!m_parent || m_parent->type != TrackedMenuEntry);
|
2014-02-24 11:59:34 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT CMenuFocusManager::PushMenuBar(CMenuBand * mb)
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
_ASSERT(m_bandCount == 0);
|
2014-02-24 11:59:34 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT hr = PushToArray(MenuBarEntry, mb, NULL);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
return UpdateFocus();
|
|
|
|
}
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT CMenuFocusManager::PushMenuPopup(CMenuBand * mb)
|
|
|
|
{
|
|
|
|
_ASSERT(!m_current || m_current->type != TrackedMenuEntry);
|
|
|
|
|
|
|
|
HRESULT hr = PushToArray(MenuPopupEntry, mb, NULL);
|
2014-03-03 16:11:47 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-02-24 11:59:34 +00:00
|
|
|
return hr;
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
hr = UpdateFocus();
|
|
|
|
|
|
|
|
if (m_parent && m_parent->type != TrackedMenuEntry)
|
2014-03-19 15:33:41 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
m_parent->mb->_SetChildBand(mb);
|
|
|
|
mb->_SetParentBand(m_parent->mb);
|
2014-03-19 15:33:41 +00:00
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
return hr;
|
2014-02-24 11:59:34 +00:00
|
|
|
}
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT CMenuFocusManager::PushTrackedPopup(HMENU popup)
|
2014-02-24 11:59:34 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
_ASSERT(m_bandCount > 0);
|
|
|
|
_ASSERT(!m_current || m_current->type != TrackedMenuEntry);
|
2014-02-24 11:59:34 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT hr = PushToArray(TrackedMenuEntry, NULL, popup);
|
2014-03-03 16:11:47 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-02-24 11:59:34 +00:00
|
|
|
return hr;
|
|
|
|
|
2014-05-18 14:20:27 +00:00
|
|
|
TRACE("PushTrackedPopup %p\n", popup);
|
2014-04-16 12:14:02 +00:00
|
|
|
m_selectedMenu = popup;
|
|
|
|
m_selectedItem = -1;
|
|
|
|
m_selectedItemFlags = 0;
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
return UpdateFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CMenuFocusManager::PopMenuBar(CMenuBand * mb)
|
|
|
|
{
|
|
|
|
StackEntryType type;
|
|
|
|
CMenuBand * mbc;
|
|
|
|
HRESULT hr;
|
2014-02-24 11:59:34 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
hr = PopFromArray(&type, &mbc, NULL);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
{
|
|
|
|
UpdateFocus();
|
|
|
|
return hr;
|
2014-03-15 21:38:15 +00:00
|
|
|
}
|
2014-03-26 11:33:52 +00:00
|
|
|
|
|
|
|
_ASSERT(type == MenuBarEntry);
|
|
|
|
if (type != MenuBarEntry)
|
|
|
|
return E_FAIL;
|
2014-03-19 15:33:41 +00:00
|
|
|
|
|
|
|
if (!mbc)
|
|
|
|
return E_FAIL;
|
2014-03-15 21:38:15 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
mbc->_SetParentBand(NULL);
|
|
|
|
|
|
|
|
hr = UpdateFocus();
|
2014-03-15 21:38:15 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
if (m_current)
|
2014-03-19 15:33:41 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
_ASSERT(m_current->type != TrackedMenuEntry);
|
|
|
|
m_current->mb->_SetChildBand(NULL);
|
2014-03-19 15:33:41 +00:00
|
|
|
}
|
2014-02-24 11:59:34 +00:00
|
|
|
|
2014-03-15 21:38:15 +00:00
|
|
|
return S_OK;
|
2014-02-24 11:59:34 +00:00
|
|
|
}
|
2014-03-17 12:33:03 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT CMenuFocusManager::PopMenuPopup(CMenuBand * mb)
|
2014-03-17 12:33:03 +00:00
|
|
|
{
|
2014-03-26 11:33:52 +00:00
|
|
|
StackEntryType type;
|
|
|
|
CMenuBand * mbc;
|
2014-03-17 12:33:03 +00:00
|
|
|
HRESULT hr;
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
hr = PopFromArray(&type, &mbc, NULL);
|
2014-03-17 12:33:03 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-03-26 11:33:52 +00:00
|
|
|
{
|
|
|
|
UpdateFocus();
|
2014-03-17 12:33:03 +00:00
|
|
|
return hr;
|
2014-03-26 11:33:52 +00:00
|
|
|
}
|
2014-03-17 12:33:03 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
_ASSERT(type == MenuPopupEntry);
|
|
|
|
if (type != MenuPopupEntry)
|
|
|
|
return E_FAIL;
|
2014-03-17 12:33:03 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
if (!mbc)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
mbc->_SetParentBand(NULL);
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
hr = UpdateFocus();
|
2014-03-19 15:33:41 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
if (m_current)
|
|
|
|
{
|
|
|
|
_ASSERT(m_current->type != TrackedMenuEntry);
|
|
|
|
m_current->mb->_SetChildBand(NULL);
|
|
|
|
}
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
HRESULT CMenuFocusManager::PopTrackedPopup(HMENU popup)
|
|
|
|
{
|
|
|
|
StackEntryType type;
|
|
|
|
HMENU hmenu;
|
|
|
|
HRESULT hr;
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
hr = PopFromArray(&type, NULL, &hmenu);
|
2014-03-19 15:33:41 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2014-03-26 11:33:52 +00:00
|
|
|
{
|
|
|
|
UpdateFocus();
|
2014-03-19 15:33:41 +00:00
|
|
|
return hr;
|
2014-03-26 11:33:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_ASSERT(type == TrackedMenuEntry);
|
|
|
|
if (type != TrackedMenuEntry)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
if (hmenu != popup)
|
|
|
|
return E_FAIL;
|
2014-03-19 15:33:41 +00:00
|
|
|
|
2014-03-26 11:33:52 +00:00
|
|
|
hr = UpdateFocus();
|
2014-03-19 15:33:41 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
return S_OK;
|
2014-03-17 12:33:03 +00:00
|
|
|
}
|