Page 1 of 1
Chrome - Show in folder
Posted: 23 Nov 2011 09:16
by Exolon
Hi,
XY is set as my default file manager. If I now click on "Show in folder" in the Chrome Downloads Tab the system switches correctly to XY and XY shows the download folder. Unfortunately the file downloaded is not set as current selected item, it is always the first element in the tab selected.
Is it possible to automatically go to the downloaded file as Windows Explorer would do?
Thanks
Exo
Re: Chrome - Show in folder
Posted: 23 Nov 2011 20:21
by admin
Probably not. I'm not sure which technique Explorer uses to do this.
Re: Chrome - Show in folder
Posted: 23 Nov 2011 20:47
by nas8e9
admin wrote:Probably not. I'm not sure which technique Explorer uses to do this.
Chrome seems to somehow call the DCom Server Process Launcher Service (DcomLaunch) hosted in a generic services.exe-process which in turn calls Windows Explorer with a command line like so:
Code: Select all
C:\Windows\explorer.exe /factory,{ceff45ee-c862-41de-aee2-a022c81eda92} -Embedding
(No, I don't know what that means and yes, I was bored.

)
Re: Chrome - Show in folder
Posted: 23 Nov 2011 21:06
by admin
nas8e9 wrote:admin wrote:Probably not. I'm not sure which technique Explorer uses to do this.
Chrome seems to somehow call the DCom Server Process Launcher Service (DcomLaunch) hosted in a generic services.exe-process which in turn calls Windows Explorer with a command line like so:
Code: Select all
C:\Windows\explorer.exe /factory,{ceff45ee-c862-41de-aee2-a022c81eda92} -Embedding
(No, I don't know what that means and yes, I was bored.

)
@Exolon: Menu Help / Various Information (in XYplorer) gives you the command line this instance of XYplorer was called with. Can you copy/paste this info into this thread please?
Re: Chrome - Show in folder
Posted: 24 Nov 2011 07:34
by Exolon
Hmm, there is no filename in the string:
Command: "F:\Downloads"
CommandW: "F:\Downloads"
Command Normalized: "F:\Downloads\"
Re: Chrome - Show in folder
Posted: 24 Nov 2011 08:00
by Exolon
O.k. I (tried) to check the Chrome code to check what happened (and why the Command line omits the filename):
The default case is to open and select the file via the API, if this fails (like in case with XY) it simply shows the folder:
Code: Select all
typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)(
PCIDLIST_ABSOLUTE pidl_Folder,
UINT cidl,
PCUITEMID_CHILD_ARRAY pidls,
DWORD flags);
static SHOpenFolderAndSelectItemsFuncPtr open_folder_and_select_itemsPtr =
NULL;
static bool initialize_open_folder_proc = true;
if (initialize_open_folder_proc) {
initialize_open_folder_proc = false;
// The SHOpenFolderAndSelectItems API is exposed by shell32 version 6
// and does not exist in Win2K. We attempt to retrieve this function export
// from shell32 and if it does not exist, we just invoke ShellExecute to
// open the folder thus losing the functionality to select the item in
// the process.
HMODULE shell32_base = GetModuleHandle(L"shell32.dll");
if (!shell32_base) {
NOTREACHED() << " " << __FUNCTION__ << "(): Can't open shell32.dll";
return;
}
open_folder_and_select_itemsPtr =
reinterpret_cast<SHOpenFolderAndSelectItemsFuncPtr>
(GetProcAddress(shell32_base, "SHOpenFolderAndSelectItems"));
}
if (!open_folder_and_select_itemsPtr) {
ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW);
return;
}
base::win::ScopedComPtr<IShellFolder> desktop;
HRESULT hr = SHGetDesktopFolder(desktop.Receive());
if (FAILED(hr))
return;
[SNIP]
hr = (*open_folder_and_select_itemsPtr)(dir_item, arraysize(highlight),
highlight, NULL);
if (FAILED(hr)) {
// On some systems, the above call mysteriously fails with "file not
// found" even though the file is there. In these cases, ShellExecute()
// seems to work as a fallback (although it won't select the file).
if (hr == ERROR_FILE_NOT_FOUND) {
ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW);
} else {
LPTSTR message = NULL;
DWORD message_length = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
0, hr, 0, reinterpret_cast<LPTSTR>(&message), 0, NULL);
LOG(WARNING) << " " << __FUNCTION__
<< "(): Can't open full_path = \""
<< full_path.value() << "\""
<< " hr = " << hr
<< " " << reinterpret_cast<LPTSTR>(&message);
if (message)
LocalFree(message);
}
}
Does this help in any way?
Re: Chrome - Show in folder
Posted: 24 Nov 2011 09:03
by Exolon
... here is the corresponding Log Message:
[4428:4688:6897787:WARNING:platform_util_win.cc(99)] platform_util::ShowItemInFolder(): Can't open full_path = "F:\Downloads\Mercurial-2.0.exe" hr = -2147467260 躈E
Re: Chrome - Show in folder
Posted: 28 Nov 2011 08:43
by admin
Thanks, but XYplorer only seems to receive "F:\Downloads" from Windows. No chance.
Re: Chrome - Show in folder
Posted: 30 Apr 2014 12:58
by gks
Much water has flown down the Thames since the last post, in this thread,
But do we have some workaround for it, as 'For ONLY UNAIDED-EYES without the blue strip on the file' it seems really hard to correctly pin-point at the required file in a huge collection of downloaded items
Re: Chrome - Show in folder
Posted: 27 Sep 2023 13:55
by Theodecarvalho
Hi. I searched for this problem and get me to here.
It is solved? When I select in my chrome: Show folder, XYplorer always opens with first file, not the last one that I downloaded.
Re: Chrome - Show in folder
Posted: 27 Sep 2023 16:50
by admin
Not fixable.