mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 05:00:27 +00:00
When calling ShellExecuteEx for the selected objects in a shell view, set the current directory to the view's directory.
svn path=/trunk/; revision=27456
This commit is contained in:
parent
3207aad442
commit
016296a635
1 changed files with 14 additions and 5 deletions
|
@ -854,6 +854,9 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
|
||||||
STGMEDIUM stgm;
|
STGMEDIUM stgm;
|
||||||
LPIDA pIDList;
|
LPIDA pIDList;
|
||||||
LPCITEMIDLIST parent_pidl;
|
LPCITEMIDLIST parent_pidl;
|
||||||
|
WCHAR parent_path[MAX_PATH];
|
||||||
|
LPCWSTR parent_dir = NULL;
|
||||||
|
SFGAOF attribs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (0 == ShellView_GetSelections(This))
|
if (0 == ShellView_GetSelections(This))
|
||||||
|
@ -887,10 +890,16 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
|
||||||
pIDList = GlobalLock(stgm.u.hGlobal);
|
pIDList = GlobalLock(stgm.u.hGlobal);
|
||||||
|
|
||||||
parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pIDList+pIDList->aoffset[0]);
|
parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pIDList+pIDList->aoffset[0]);
|
||||||
|
hr = IShellFolder_GetAttributesOf(This->pSFParent, 1, &parent_pidl, &attribs);
|
||||||
|
if (SUCCEEDED(hr) && (attribs & SFGAO_FILESYSTEM) &&
|
||||||
|
SHGetPathFromIDListW(parent_pidl, parent_path))
|
||||||
|
{
|
||||||
|
parent_dir = parent_path;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = pIDList->cidl; i > 0; --i)
|
for (i = pIDList->cidl; i > 0; --i)
|
||||||
{
|
{
|
||||||
LPCITEMIDLIST pidl;
|
LPCITEMIDLIST pidl;
|
||||||
SFGAOF attribs;
|
|
||||||
|
|
||||||
pidl = (LPCITEMIDLIST)((LPBYTE)pIDList+pIDList->aoffset[i]);
|
pidl = (LPCITEMIDLIST)((LPBYTE)pIDList+pIDList->aoffset[i]);
|
||||||
|
|
||||||
|
@ -899,19 +908,19 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
|
||||||
|
|
||||||
if (SUCCEEDED(hr) && ! (attribs & SFGAO_FOLDER))
|
if (SUCCEEDED(hr) && ! (attribs & SFGAO_FOLDER))
|
||||||
{
|
{
|
||||||
SHELLEXECUTEINFOA shexinfo;
|
SHELLEXECUTEINFOW shexinfo;
|
||||||
|
|
||||||
shexinfo.cbSize = sizeof(SHELLEXECUTEINFOA);
|
shexinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
|
||||||
shexinfo.fMask = SEE_MASK_INVOKEIDLIST; /* SEE_MASK_IDLIST is also possible. */
|
shexinfo.fMask = SEE_MASK_INVOKEIDLIST; /* SEE_MASK_IDLIST is also possible. */
|
||||||
shexinfo.hwnd = NULL;
|
shexinfo.hwnd = NULL;
|
||||||
shexinfo.lpVerb = NULL;
|
shexinfo.lpVerb = NULL;
|
||||||
shexinfo.lpFile = NULL;
|
shexinfo.lpFile = NULL;
|
||||||
shexinfo.lpParameters = NULL;
|
shexinfo.lpParameters = NULL;
|
||||||
shexinfo.lpDirectory = NULL;
|
shexinfo.lpDirectory = parent_dir;
|
||||||
shexinfo.nShow = SW_NORMAL;
|
shexinfo.nShow = SW_NORMAL;
|
||||||
shexinfo.lpIDList = ILCombine(parent_pidl, pidl);
|
shexinfo.lpIDList = ILCombine(parent_pidl, pidl);
|
||||||
|
|
||||||
ShellExecuteExA(&shexinfo); /* Discard error/success info */
|
ShellExecuteExW(&shexinfo); /* Discard error/success info */
|
||||||
|
|
||||||
ILFree((LPITEMIDLIST)shexinfo.lpIDList);
|
ILFree((LPITEMIDLIST)shexinfo.lpIDList);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue