1999-07-25 14:18:30 +02:00
|
|
|
/*
|
|
|
|
* IContextMenu
|
|
|
|
* ShellView Background Context Menu (shv_bg_cm)
|
|
|
|
*
|
|
|
|
* Copyright 1999 Juergen Schmied <juergen.schmied@metronet.de>
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-07-25 14:18:30 +02:00
|
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
2003-01-07 21:36:20 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2004-10-07 05:06:48 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-07-25 14:18:30 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "wingdi.h"
|
1999-07-25 14:18:30 +02:00
|
|
|
#include "pidl.h"
|
2000-08-03 06:19:24 +02:00
|
|
|
#include "shlguid.h"
|
2002-12-05 21:33:07 +01:00
|
|
|
#include "shlobj.h"
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
#include "shell32_main.h"
|
2000-02-20 19:47:41 +01:00
|
|
|
#include "shellfolder.h"
|
2001-08-16 20:49:56 +02:00
|
|
|
#include "undocshell.h"
|
1999-07-25 14:18:30 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IContextMenu Implementation
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
typedef struct
|
2000-02-20 19:47:41 +01:00
|
|
|
{
|
2005-06-06 21:50:35 +02:00
|
|
|
const IContextMenu2Vtbl *lpVtbl;
|
2000-02-20 19:47:41 +01:00
|
|
|
IShellFolder* pSFParent;
|
2005-07-03 14:03:35 +02:00
|
|
|
LONG ref;
|
2005-03-14 11:49:03 +01:00
|
|
|
BOOL bDesktop;
|
1999-07-25 14:18:30 +02:00
|
|
|
} BgCmImpl;
|
|
|
|
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IContextMenu2Vtbl cmvt;
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISVBgCm_Constructor()
|
|
|
|
*/
|
2005-03-14 11:49:03 +01:00
|
|
|
IContextMenu2 *ISvBgCm_Constructor(IShellFolder* pSFParent, BOOL bDesktop)
|
1999-07-25 14:18:30 +02:00
|
|
|
{
|
|
|
|
BgCmImpl* cm;
|
|
|
|
|
2005-03-21 12:25:13 +01:00
|
|
|
cm = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl));
|
2003-04-10 20:17:34 +02:00
|
|
|
cm->lpVtbl = &cmvt;
|
1999-07-25 14:18:30 +02:00
|
|
|
cm->ref = 1;
|
2000-02-20 19:47:41 +01:00
|
|
|
cm->pSFParent = pSFParent;
|
2005-03-14 11:49:03 +01:00
|
|
|
cm->bDesktop = bDesktop;
|
2000-02-20 19:47:41 +01:00
|
|
|
if(pSFParent) IShellFolder_AddRef(pSFParent);
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->()\n",cm);
|
2003-09-09 21:32:36 +02:00
|
|
|
return (IContextMenu2*)cm;
|
1999-07-25 14:18:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISVBgCm_fnQueryInterface
|
|
|
|
*/
|
2003-09-09 21:32:36 +02:00
|
|
|
static HRESULT WINAPI ISVBgCm_fnQueryInterface(IContextMenu2 *iface, REFIID riid, LPVOID *ppvObj)
|
1999-07-25 14:18:30 +02:00
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
BgCmImpl *This = (BgCmImpl *)iface;
|
1999-07-25 14:18:30 +02:00
|
|
|
|
2000-01-18 06:09:49 +01:00
|
|
|
TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
*ppvObj = NULL;
|
|
|
|
|
2003-09-09 21:32:36 +02:00
|
|
|
if(IsEqualIID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid, &IID_IContextMenu) ||
|
|
|
|
IsEqualIID(riid, &IID_IContextMenu2))
|
1999-07-25 14:18:30 +02:00
|
|
|
{
|
|
|
|
*ppvObj = This;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1999-07-25 14:18:30 +02:00
|
|
|
else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/
|
|
|
|
{
|
|
|
|
FIXME("-- LPSHELLEXTINIT pointer requested\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppvObj)
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppvObj);
|
1999-07-25 14:18:30 +02:00
|
|
|
TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
TRACE("-- Interface: E_NOINTERFACE\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISVBgCm_fnAddRef
|
|
|
|
*/
|
2003-09-09 21:32:36 +02:00
|
|
|
static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu2 *iface)
|
1999-07-25 14:18:30 +02:00
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
BgCmImpl *This = (BgCmImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
1999-07-25 14:18:30 +02:00
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
|
1999-07-25 14:18:30 +02:00
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
1999-07-25 14:18:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISVBgCm_fnRelease
|
|
|
|
*/
|
2003-09-09 21:32:36 +02:00
|
|
|
static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu2 *iface)
|
1999-07-25 14:18:30 +02:00
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
BgCmImpl *This = (BgCmImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
1999-07-25 14:18:30 +02:00
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
TRACE("(%p)->(count=%li)\n", This, refCount + 1);
|
1999-07-25 14:18:30 +02:00
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
if (!refCount)
|
2000-02-20 19:47:41 +01:00
|
|
|
{
|
|
|
|
TRACE(" destroying IContextMenu(%p)\n",This);
|
|
|
|
|
|
|
|
if(This->pSFParent)
|
|
|
|
IShellFolder_Release(This->pSFParent);
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
}
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
1999-07-25 14:18:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISVBgCm_fnQueryContextMenu()
|
|
|
|
*/
|
|
|
|
|
|
|
|
static HRESULT WINAPI ISVBgCm_fnQueryContextMenu(
|
2003-09-09 21:32:36 +02:00
|
|
|
IContextMenu2 *iface,
|
1999-07-25 14:18:30 +02:00
|
|
|
HMENU hMenu,
|
|
|
|
UINT indexMenu,
|
|
|
|
UINT idCmdFirst,
|
|
|
|
UINT idCmdLast,
|
|
|
|
UINT uFlags)
|
|
|
|
{
|
2002-08-17 01:27:46 +02:00
|
|
|
HMENU hMyMenu;
|
|
|
|
UINT idMax;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2004-09-09 22:17:07 +02:00
|
|
|
BgCmImpl *This = (BgCmImpl *)iface;
|
2002-08-17 01:27:46 +02:00
|
|
|
|
2002-11-22 00:56:42 +01:00
|
|
|
TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",
|
2002-08-17 01:27:46 +02:00
|
|
|
This, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
|
|
|
|
|
|
|
|
|
|
|
|
hMyMenu = LoadMenuA(shell32_hInstance, "MENU_002");
|
|
|
|
if (uFlags & CMF_DEFAULTONLY)
|
|
|
|
{
|
|
|
|
HMENU ourMenu = GetSubMenu(hMyMenu,0);
|
|
|
|
UINT oldDef = GetMenuDefaultItem(hMenu,TRUE,GMDI_USEDISABLED);
|
|
|
|
UINT newDef = GetMenuDefaultItem(ourMenu,TRUE,GMDI_USEDISABLED);
|
|
|
|
if (newDef != oldDef)
|
|
|
|
SetMenuDefaultItem(hMenu,newDef,TRUE);
|
|
|
|
if (newDef!=0xFFFFFFFF)
|
|
|
|
hr = MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, newDef+1);
|
|
|
|
else
|
|
|
|
hr = MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
idMax = Shell_MergeMenus (hMenu, GetSubMenu(hMyMenu,0), indexMenu,
|
|
|
|
idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS);
|
|
|
|
hr = MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, idMax-idCmdFirst+1);
|
|
|
|
}
|
|
|
|
DestroyMenu(hMyMenu);
|
|
|
|
|
|
|
|
TRACE("(%p)->returning 0x%lx\n",This,hr);
|
|
|
|
return hr;
|
1999-07-25 14:18:30 +02:00
|
|
|
}
|
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* DoNewFolder
|
|
|
|
*/
|
|
|
|
static void DoNewFolder(
|
2003-09-09 21:32:36 +02:00
|
|
|
IContextMenu2 *iface,
|
2000-02-20 19:47:41 +01:00
|
|
|
IShellView *psv)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
BgCmImpl *This = (BgCmImpl *)iface;
|
2000-02-20 19:47:41 +01:00
|
|
|
ISFHelper * psfhlp;
|
|
|
|
char szName[MAX_PATH];
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlp);
|
|
|
|
if (psfhlp)
|
|
|
|
{
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
ISFHelper_GetUniqueName(psfhlp, szName, MAX_PATH);
|
|
|
|
ISFHelper_AddFolder(psfhlp, 0, szName, &pidl);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
if(psv)
|
|
|
|
{
|
|
|
|
/* if we are in a shellview do labeledit */
|
|
|
|
IShellView_SelectItem(psv,
|
|
|
|
pidl,(SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE
|
|
|
|
|SVSI_FOCUSED|SVSI_SELECT));
|
|
|
|
}
|
|
|
|
SHFree(pidl);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
ISFHelper_Release(psfhlp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* DoPaste
|
|
|
|
*/
|
|
|
|
static BOOL DoPaste(
|
2003-09-09 21:32:36 +02:00
|
|
|
IContextMenu2 *iface)
|
2000-02-20 19:47:41 +01:00
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
BgCmImpl *This = (BgCmImpl *)iface;
|
2000-02-20 19:47:41 +01:00
|
|
|
BOOL bSuccess = FALSE;
|
|
|
|
IDataObject * pda;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
TRACE("\n");
|
|
|
|
|
2004-06-18 02:23:38 +02:00
|
|
|
if(SUCCEEDED(OleGetClipboard(&pda)))
|
2000-02-20 19:47:41 +01:00
|
|
|
{
|
|
|
|
STGMEDIUM medium;
|
|
|
|
FORMATETC formatetc;
|
|
|
|
|
|
|
|
TRACE("pda=%p\n", pda);
|
|
|
|
|
|
|
|
/* Set the FORMATETC structure*/
|
|
|
|
InitFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL);
|
|
|
|
|
|
|
|
/* Get the pidls from IDataObject */
|
|
|
|
if(SUCCEEDED(IDataObject_GetData(pda,&formatetc,&medium)))
|
|
|
|
{
|
|
|
|
LPITEMIDLIST * apidl;
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
IShellFolder *psfFrom = NULL, *psfDesktop;
|
|
|
|
|
2002-11-12 02:05:00 +01:00
|
|
|
LPIDA lpcida = GlobalLock(medium.u.hGlobal);
|
2000-02-20 19:47:41 +01:00
|
|
|
TRACE("cida=%p\n", lpcida);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
/* bind to the source shellfolder */
|
|
|
|
SHGetDesktopFolder(&psfDesktop);
|
|
|
|
if(psfDesktop)
|
|
|
|
{
|
|
|
|
IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (LPVOID*)&psfFrom);
|
|
|
|
IShellFolder_Release(psfDesktop);
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
if (psfFrom)
|
|
|
|
{
|
|
|
|
/* get source and destination shellfolder */
|
|
|
|
ISFHelper *psfhlpdst, *psfhlpsrc;
|
|
|
|
IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlpdst);
|
|
|
|
IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (LPVOID*)&psfhlpsrc);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
/* do the copy/move */
|
|
|
|
if (psfhlpdst && psfhlpsrc)
|
|
|
|
{
|
2003-09-02 03:01:06 +02:00
|
|
|
ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, (LPCITEMIDLIST*)apidl);
|
2002-06-01 01:06:46 +02:00
|
|
|
/* FIXME handle move
|
2000-02-20 19:47:41 +01:00
|
|
|
ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, apidl);
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
|
|
|
|
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
|
|
|
|
IShellFolder_Release(psfFrom);
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
_ILFreeaPidl(apidl, lpcida->cidl);
|
|
|
|
SHFree(pidl);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
/* release the medium*/
|
2004-06-18 02:23:38 +02:00
|
|
|
ReleaseStgMedium(&medium);
|
2000-02-20 19:47:41 +01:00
|
|
|
}
|
|
|
|
IDataObject_Release(pda);
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
HGLOBAL hMem;
|
|
|
|
|
|
|
|
OpenClipboard(NULL);
|
|
|
|
hMem = GetClipboardData(CF_HDROP);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
if(hMem)
|
|
|
|
{
|
|
|
|
char * pDropFiles = (char *)GlobalLock(hMem);
|
|
|
|
if(pDropFiles)
|
|
|
|
{
|
|
|
|
int len, offset = sizeof(DROPFILESTRUCT);
|
|
|
|
|
|
|
|
while( pDropFiles[offset] != 0)
|
|
|
|
{
|
|
|
|
len = strlen(pDropFiles + offset);
|
|
|
|
TRACE("%s\n", pDropFiles + offset);
|
|
|
|
offset += len+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GlobalUnlock(hMem);
|
|
|
|
}
|
|
|
|
CloseClipboard();
|
|
|
|
#endif
|
|
|
|
return bSuccess;
|
|
|
|
}
|
2004-01-09 01:35:21 +01:00
|
|
|
|
1999-07-25 14:18:30 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* ISVBgCm_fnInvokeCommand()
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI ISVBgCm_fnInvokeCommand(
|
2003-09-09 21:32:36 +02:00
|
|
|
IContextMenu2 *iface,
|
1999-07-25 14:18:30 +02:00
|
|
|
LPCMINVOKECOMMANDINFO lpcmi)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
BgCmImpl *This = (BgCmImpl *)iface;
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
LPSHELLBROWSER lpSB;
|
2004-01-09 01:35:21 +01:00
|
|
|
LPSHELLVIEW lpSV = NULL;
|
|
|
|
HWND hWndSV = 0;
|
1999-07-25 14:18:30 +02:00
|
|
|
|
2002-11-22 00:56:42 +01:00
|
|
|
TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd);
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
/* get the active IShellView */
|
2000-02-20 19:47:41 +01:00
|
|
|
if((lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0)))
|
1999-07-25 14:18:30 +02:00
|
|
|
{
|
2000-02-20 19:47:41 +01:00
|
|
|
if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV)))
|
1999-07-25 14:18:30 +02:00
|
|
|
{
|
2000-02-20 19:47:41 +01:00
|
|
|
IShellView_GetWindow(lpSV, &hWndSV);
|
1999-07-25 14:18:30 +02:00
|
|
|
}
|
2000-02-20 19:47:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(HIWORD(lpcmi->lpVerb))
|
1999-07-25 14:18:30 +02:00
|
|
|
{
|
2000-02-20 19:47:41 +01:00
|
|
|
TRACE("%s\n",lpcmi->lpVerb);
|
|
|
|
|
|
|
|
if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA))
|
|
|
|
{
|
2004-01-09 01:35:21 +01:00
|
|
|
DoNewFolder(iface, lpSV);
|
2000-02-20 19:47:41 +01:00
|
|
|
}
|
|
|
|
else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA))
|
|
|
|
{
|
|
|
|
if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 );
|
|
|
|
}
|
|
|
|
else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA))
|
|
|
|
{
|
|
|
|
if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 );
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-02-20 19:47:41 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("please report: unknown verb %s\n",lpcmi->lpVerb);
|
|
|
|
}
|
1999-07-25 14:18:30 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-02-20 19:47:41 +01:00
|
|
|
switch(LOWORD(lpcmi->lpVerb))
|
|
|
|
{
|
2005-08-19 12:02:51 +02:00
|
|
|
case FCIDM_SHVIEW_REFRESH:
|
|
|
|
if (lpSV) IShellView_Refresh(lpSV);
|
|
|
|
break;
|
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
case FCIDM_SHVIEW_NEWFOLDER:
|
|
|
|
DoNewFolder(iface, lpSV);
|
|
|
|
break;
|
2005-03-14 11:49:03 +01:00
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
case FCIDM_SHVIEW_INSERT:
|
|
|
|
DoPaste(iface);
|
|
|
|
break;
|
2005-03-14 11:49:03 +01:00
|
|
|
|
|
|
|
case FCIDM_SHVIEW_PROPERTIES:
|
|
|
|
if (This->bDesktop) {
|
|
|
|
ShellExecuteA(lpcmi->hwnd, "open", "rundll32.exe shell32.dll,Control_RunDLL desk.cpl", NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
} else {
|
|
|
|
FIXME("launch item properties dialog\n");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2000-02-20 19:47:41 +01:00
|
|
|
default:
|
2005-03-23 14:15:18 +01:00
|
|
|
/* if it's an id just pass it to the parent shv */
|
2005-03-14 11:49:03 +01:00
|
|
|
if (hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 );
|
2000-02-20 19:47:41 +01:00
|
|
|
break;
|
|
|
|
}
|
1999-07-25 14:18:30 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-09 01:35:21 +01:00
|
|
|
if (lpSV)
|
2005-03-23 14:15:18 +01:00
|
|
|
IShellView_Release(lpSV); /* QueryActiveShellView does AddRef */
|
2004-01-09 01:35:21 +01:00
|
|
|
|
1999-07-25 14:18:30 +02:00
|
|
|
return NOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISVBgCm_fnGetCommandString()
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI ISVBgCm_fnGetCommandString(
|
2003-09-09 21:32:36 +02:00
|
|
|
IContextMenu2 *iface,
|
1999-07-25 14:18:30 +02:00
|
|
|
UINT idCommand,
|
|
|
|
UINT uFlags,
|
2002-09-17 03:35:09 +02:00
|
|
|
UINT* lpReserved,
|
1999-07-25 14:18:30 +02:00
|
|
|
LPSTR lpszName,
|
|
|
|
UINT uMaxNameLen)
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
BgCmImpl *This = (BgCmImpl *)iface;
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(idcom=%x flags=%x %p name=%p len=%x)\n",This, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* test the existence of the menu items, the file dialog enables
|
1999-07-25 14:18:30 +02:00
|
|
|
the buttons according to this */
|
|
|
|
if (uFlags == GCS_VALIDATEA)
|
|
|
|
{
|
1999-08-15 16:31:36 +02:00
|
|
|
if(HIWORD(idCommand))
|
|
|
|
{
|
|
|
|
if (!strcmp((LPSTR)idCommand, CMDSTR_VIEWLISTA) ||
|
|
|
|
!strcmp((LPSTR)idCommand, CMDSTR_VIEWDETAILSA) ||
|
|
|
|
!strcmp((LPSTR)idCommand, CMDSTR_NEWFOLDERA))
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
1999-08-15 16:31:36 +02:00
|
|
|
return NOERROR;
|
|
|
|
}
|
1999-07-25 14:18:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("unknown command string\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISVBgCm_fnHandleMenuMsg()
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI ISVBgCm_fnHandleMenuMsg(
|
2003-09-09 21:32:36 +02:00
|
|
|
IContextMenu2 *iface,
|
1999-07-25 14:18:30 +02:00
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
BgCmImpl *This = (BgCmImpl *)iface;
|
1999-07-25 14:18:30 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(msg=%x wp=%x lp=%lx)\n",This, uMsg, wParam, lParam);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2003-09-09 21:32:36 +02:00
|
|
|
* IContextMenu2 VTable
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-07-25 14:18:30 +02:00
|
|
|
*/
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IContextMenu2Vtbl cmvt =
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
1999-07-25 14:18:30 +02:00
|
|
|
ISVBgCm_fnQueryInterface,
|
|
|
|
ISVBgCm_fnAddRef,
|
|
|
|
ISVBgCm_fnRelease,
|
|
|
|
ISVBgCm_fnQueryContextMenu,
|
|
|
|
ISVBgCm_fnInvokeCommand,
|
|
|
|
ISVBgCm_fnGetCommandString,
|
2003-09-09 21:32:36 +02:00
|
|
|
ISVBgCm_fnHandleMenuMsg
|
1999-07-25 14:18:30 +02:00
|
|
|
};
|