Using the code described in this answer of SO's publication βOpen a folder and select a fileβ , I created this function:
public static void OpenExplorerAndSelectFile(string filePath) { Process.Start( @"explorer.exe", string.Format(@"/select, ""{0}""", filePath)); }
This function works well, with one small problem:
Calling the function for the first time for a specific file, Windows Explorer displays correctly with the file folder, but does not select the file .
Calling the same function again for the same file, it switches back to the already open folder in Windows Explorer, and then selects the file.
eg. the first call to OpenExplorerAndSelectFile("C:\MyFolder\MyFile.txt") opens the folder "C: \ MyFolder" in a new window in Windows Explorer. The second call to OpenExplorerAndSelectFile("C:\MyFolder\MyFile.txt") activates this window again and selects MyFile.txt .
Doing something like this, for example. Google Chrome (going to the download page and displaying a previously downloaded file) actually works well on the first try.
So, I came to the conclusion that Google Chrome seems to do this a little differently than me.
My question is:
Is there any way to debug / track the Win32 / Shell method that calls Google Chrome?
Then I compared them to what I do to see the differences.
source share