*/
#include "shellbars.h"
-#include <commoncontrols.h>
-#include <strsafe.h>
-#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
-#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
+#include <commoncontrols.h>
+#include <shellapi.h>
+#include <wingdi.h>
+#include <uxtheme.h>
-// ***Extras***
-/*++
-* @name _ILIsDesktop
-*
-* Checks whether the given PIDL is of Desktop folder or not.
-*
-* @param pidl
-* PIDL to be checked.
-*
-* @return True if PIDL is of Desktop, otherwise false.
-*
-*--*/
-static BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
-{
- return (pidl == NULL || pidl->mkid.cb == 0);
-}
+/*
+TODO:
+ ** drag and drop support
+ ** tooltips
+ ** handle change notifications
+ ** Fix position of the items context menu
+ ** Implement responding to theme change
+*/
//*****************************************************************************************
// *** CISFBand ***
if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand))
{
+ if (nCmdID == DBID_SETWINDOWTHEME)
+ {
+ if (pvaIn && V_VT(pvaIn) == VT_BSTR && V_BSTR(pvaIn))
+ {
+ SetWindowTheme(m_hWnd, V_BSTR(pvaIn), NULL);
+ }
+ }
return S_OK;
}
if (FAILED_UNEXPECTEDLY(hr)) return hr;
break;
}
+ case IDM_OPEN_FOLDER:
+ {
+ SHELLEXECUTEINFO shexinfo;
+
+ memset(&shexinfo, 0x0, sizeof(shexinfo));
+
+ shexinfo.cbSize = sizeof(shexinfo);
+ shexinfo.fMask = SEE_MASK_IDLIST;
+ shexinfo.lpVerb = _T("open");
+ shexinfo.lpIDList = m_pidl;
+ shexinfo.nShow = SW_SHOW;
+
+ if (!ShellExecuteEx(&shexinfo))
+ return E_FAIL;
+
+ break;
+ }
case IDM_SHOW_TEXT:
{
if (m_textFlag)
CheckMenuItem(qMenu, IDM_SMALL_ICONS, MF_UNCHECKED);
}
+ if (_ILIsDesktop(m_pidl))
+ DeleteMenu(qMenu, IDM_OPEN_FOLDER, MF_BYCOMMAND);
+
UINT idMax = Shell_MergeMenus(hmenu, GetSubMenu(qMenu, 0), indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS);
DestroyMenu(qMenu);
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(idMax - idCmdFirst +1));