[SHELL32]

- Hackfix shell new item service
- Add support for SID_IFolderView

svn path=/trunk/; revision=54217
This commit is contained in:
Johannes Anderwald 2011-10-20 20:28:30 +00:00
parent 420fff03dc
commit 50023c1e97
3 changed files with 15 additions and 12 deletions

View file

@ -2817,6 +2817,9 @@ HRESULT STDMETHODCALLTYPE CDefView::QueryService(REFGUID guidService, REFIID rii
{ {
if (IsEqualIID(guidService, SID_IShellBrowser)) if (IsEqualIID(guidService, SID_IShellBrowser))
return pShellBrowser->QueryInterface(riid, ppvObject); return pShellBrowser->QueryInterface(riid, ppvObject);
else if(IsEqualIID(guidService, SID_IFolderView))
return QueryInterface(riid, ppvObject);
return E_NOINTERFACE; return E_NOINTERFACE;
} }

View file

@ -336,7 +336,7 @@ CNewMenu::InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu)
} }
HRESULT HRESULT
CNewMenu::DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi) CNewMenu::DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi, IShellView *psv)
{ {
SHELLNEW_ITEM *pCurItem = s_SnHead; SHELLNEW_ITEM *pCurItem = s_SnHead;
IPersistFolder3 * psf; IPersistFolder3 * psf;
@ -372,9 +372,9 @@ CNewMenu::DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi)
if (!pCurItem) if (!pCurItem)
return E_UNEXPECTED; return E_UNEXPECTED;
if (fSite == NULL) //if (fSite == NULL)
return E_FAIL; // return E_FAIL;
hResult = IUnknown_QueryService(fSite, SID_IFolderView, IID_IFolderView, (void **)&folderView); hResult = IUnknown_QueryService(psv, SID_IFolderView, IID_IFolderView, (void **)&folderView);
if (FAILED(hResult)) if (FAILED(hResult))
return hResult; return hResult;
hResult = folderView->GetFolder(IID_IShellFolder, (void **)&parentFolder); hResult = folderView->GetFolder(IID_IShellFolder, (void **)&parentFolder);
@ -575,9 +575,9 @@ void CNewMenu::DoNewFolder(
CComPtr<IShellFolder> parentFolder; CComPtr<IShellFolder> parentFolder;
HRESULT hResult; HRESULT hResult;
if (fSite == NULL) //if (fSite == NULL)
return; // return;
hResult = IUnknown_QueryService(fSite, SID_IFolderView, IID_IFolderView, (void **)&folderView); hResult = IUnknown_QueryService(psv, SID_IFolderView, IID_IFolderView, (void **)&folderView);
if (FAILED(hResult)) if (FAILED(hResult))
return; return;
hResult = folderView->GetFolder(IID_IShellFolder, (void **)&parentFolder); hResult = folderView->GetFolder(IID_IShellFolder, (void **)&parentFolder);
@ -620,8 +620,8 @@ HRESULT STDMETHODCALLTYPE CNewMenu::GetSite(REFIID riid, void **ppvSite)
if (ppvSite == NULL) if (ppvSite == NULL)
return E_POINTER; return E_POINTER;
*ppvSite = fSite; *ppvSite = fSite;
if (fSite.p != NULL) if (fSite != NULL)
fSite.p->AddRef(); fSite->AddRef();
return S_OK; return S_OK;
} }
@ -690,7 +690,7 @@ CNewMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
return S_OK; return S_OK;
} }
hr = DoShellNewCmd(lpici); hr = DoShellNewCmd(lpici, lpSV);
if (SUCCEEDED(hr) && lpSV) if (SUCCEEDED(hr) && lpSV)
{ {
lpSV->Refresh(); lpSV->Refresh();

View file

@ -51,7 +51,7 @@ private:
LPWSTR szPath; LPWSTR szPath;
SHELLNEW_ITEM *s_SnHead; SHELLNEW_ITEM *s_SnHead;
CComPtr<IUnknown> fSite; IUnknown* fSite;
public: public:
CNewMenu(); CNewMenu();
~CNewMenu(); ~CNewMenu();
@ -60,7 +60,7 @@ public:
void UnloadShellItems(); void UnloadShellItems();
BOOL LoadShellNewItems(); BOOL LoadShellNewItems();
UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu); UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu);
HRESULT DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi); HRESULT DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi, IShellView * psv);
HRESULT DoMeasureItem(HWND hWnd, MEASUREITEMSTRUCT *lpmis); HRESULT DoMeasureItem(HWND hWnd, MEASUREITEMSTRUCT *lpmis);
HRESULT DoDrawItem(HWND hWnd, DRAWITEMSTRUCT *drawItem); HRESULT DoDrawItem(HWND hWnd, DRAWITEMSTRUCT *drawItem);
void DoNewFolder(IShellView *psv); void DoNewFolder(IShellView *psv);