fixed ShellFolderContextMenu() parameter

svn path=/trunk/; revision=7141
This commit is contained in:
Martin Fuchs 2003-12-20 18:52:50 +00:00
parent 69090b81d4
commit 5ff90962eb
2 changed files with 11 additions and 3 deletions

View file

@ -327,13 +327,21 @@ bool DesktopShellView::DoContextMenu(int x, int y)
} }
LPIDA pida = pidList; LPIDA pida = pidList;
if (!pida->cidl) {
selection->Release();
return false;
}
LPCITEMIDLIST parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]); LPCITEMIDLIST parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]);
LPCITEMIDLIST first_pidl = (LPCITEMIDLIST)((LPBYTE)pida+pida->aoffset[1]);
LPCITEMIDLIST* apidl = (LPCITEMIDLIST*) alloca(pida->cidl*sizeof(LPCITEMIDLIST));
for(int i=pida->cidl; i>0; --i)
apidl[i-1] = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]);
ShellFolder folder(parent_pidl); ShellFolder folder(parent_pidl);
hr = ShellFolderContextMenu(folder, _hwnd, pida->cidl, &first_pidl, x, y); hr = ShellFolderContextMenu(folder, _hwnd, pida->cidl, apidl, x, y);
selection->Release(); selection->Release();

View file

@ -219,7 +219,7 @@ int MainFrame::OpenShellFolders(LPIDA pida, HWND hFrameWnd)
ShellFolder folder(parent_pidl); ShellFolder folder(parent_pidl);
for(int i=pida->cidl; i>0; --i) { for(int i=pida->cidl; i>0; --i) {
LPCITEMIDLIST pidl = (LPCITEMIDLIST)((LPBYTE)pida+pida->aoffset[i]); LPCITEMIDLIST pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]);
SFGAOF attribs = SFGAO_FOLDER; SFGAOF attribs = SFGAO_FOLDER;
HRESULT hr = folder->GetAttributesOf(1, &pidl, &attribs); HRESULT hr = folder->GetAttributesOf(1, &pidl, &attribs);