launch display properties dialog via desktop context menu

svn path=/trunk/; revision=14012
This commit is contained in:
Martin Fuchs 2005-03-13 15:43:02 +00:00
parent c9f8b0e7e0
commit 85fdc76fb2
4 changed files with 59 additions and 31 deletions

View file

@ -81,7 +81,7 @@ LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT, const FORMATETC []);
LPCLASSFACTORY IClassFactory_Constructor(REFCLSID); LPCLASSFACTORY IClassFactory_Constructor(REFCLSID);
IContextMenu2 * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *aPidls, UINT uItemCount); IContextMenu2 * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *aPidls, UINT uItemCount);
IContextMenu2 * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent); IContextMenu2 * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop);
LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER); LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER);
HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);

View file

@ -473,32 +473,48 @@ static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
if (ppvOut) { if (ppvOut) {
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID (riid, &IID_IContextMenu)) { if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl); {
hr = S_OK; pObj = (LPUNKNOWN) IDataObject_Constructor( hwndOwner,
} else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) { This->pidlRoot, apidl, cidl);
pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl); hr = S_OK;
hr = S_OK; }
} else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) { else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
pidl = ILCombine (This->pidlRoot, apidl[0]); IsEqualIID(riid,&IID_IShellLinkA)) && (cidl == 1))
pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl); {
SHFree (pidl); pidl = ILCombine (This->pidlRoot, apidl[0]);
hr = S_OK; hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj);
} else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) { SHFree (pidl);
pidl = ILCombine (This->pidlRoot, apidl[0]); }
pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl); else if (IsEqualIID (riid, &IID_IContextMenu))
SHFree (pidl); {
hr = S_OK; if (cidl > 0)
} else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) { pObj = (LPUNKNOWN) ISvItemCm_Constructor( (IShellFolder *) iface, This->pidlRoot, apidl, cidl);
hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj); else
} else if ((IsEqualIID(riid,&IID_IShellLinkW) || IsEqualIID(riid,&IID_IShellLinkA)) pObj = (LPUNKNOWN) ISvBgCm_Constructor( (IShellFolder *) iface, TRUE);
&& (cidl == 1)) { hr = S_OK;
pidl = ILCombine (This->pidlRoot, apidl[0]); }
hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj); else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
SHFree (pidl); {
} else { pidl = ILCombine (This->pidlRoot, apidl[0]);
hr = E_NOINTERFACE; pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
} SHFree (pidl);
hr = S_OK;
}
else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
{
pidl = ILCombine (This->pidlRoot, apidl[0]);
pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
SHFree (pidl);
hr = S_OK;
}
else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
{
hr = IShellFolder_QueryInterface (iface,
&IID_IDropTarget, (LPVOID *) & pObj);
}
else
hr = E_NOINTERFACE;
if (SUCCEEDED(hr) && !pObj) if (SUCCEEDED(hr) && !pObj)
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;

View file

@ -988,7 +988,7 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
{ {
hMenu = CreatePopupMenu(); hMenu = CreatePopupMenu();
pCM = ISvBgCm_Constructor(This->pSFParent); pCM = ISvBgCm_Constructor(This->pSFParent, FALSE);
IContextMenu2_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0); IContextMenu2_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL); uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
@ -1977,7 +1977,7 @@ static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem,
switch(uItem) switch(uItem)
{ {
case SVGIO_BACKGROUND: case SVGIO_BACKGROUND:
*ppvOut = ISvBgCm_Constructor(This->pSFParent); *ppvOut = ISvBgCm_Constructor(This->pSFParent, FALSE);
break; break;
case SVGIO_SELECTION: case SVGIO_SELECTION:

View file

@ -46,6 +46,7 @@ typedef struct
IContextMenu2Vtbl *lpVtbl; IContextMenu2Vtbl *lpVtbl;
IShellFolder* pSFParent; IShellFolder* pSFParent;
DWORD ref; DWORD ref;
BOOL bDesktop;
} BgCmImpl; } BgCmImpl;
@ -54,7 +55,7 @@ static struct IContextMenu2Vtbl cmvt;
/************************************************************************** /**************************************************************************
* ISVBgCm_Constructor() * ISVBgCm_Constructor()
*/ */
IContextMenu2 *ISvBgCm_Constructor(IShellFolder* pSFParent) IContextMenu2 *ISvBgCm_Constructor(IShellFolder* pSFParent, BOOL bDesktop)
{ {
BgCmImpl* cm; BgCmImpl* cm;
@ -62,6 +63,7 @@ IContextMenu2 *ISvBgCm_Constructor(IShellFolder* pSFParent)
cm->lpVtbl = &cmvt; cm->lpVtbl = &cmvt;
cm->ref = 1; cm->ref = 1;
cm->pSFParent = pSFParent; cm->pSFParent = pSFParent;
cm->bDesktop = bDesktop;
if(pSFParent) IShellFolder_AddRef(pSFParent); if(pSFParent) IShellFolder_AddRef(pSFParent);
TRACE("(%p)->()\n",cm); TRACE("(%p)->()\n",cm);
@ -362,12 +364,22 @@ static HRESULT WINAPI ISVBgCm_fnInvokeCommand(
case FCIDM_SHVIEW_NEWFOLDER: case FCIDM_SHVIEW_NEWFOLDER:
DoNewFolder(iface, lpSV); DoNewFolder(iface, lpSV);
break; break;
case FCIDM_SHVIEW_INSERT: case FCIDM_SHVIEW_INSERT:
DoPaste(iface); DoPaste(iface);
break; break;
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;
default: default:
/* if it's a id just pass it to the parent shv */ /* if it's a id just pass it to the parent shv */
SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 ); if (hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 );
break; break;
} }
} }