Raymai97 / OpenFolderAndSelectItem

Tiny EXE to open folder and select a file/folder in Windows Explorer
10 stars 4 forks source link

Feature request: Force reuse of explorer.exe instance #3

Open EdoFro opened 1 year ago

EdoFro commented 1 year ago

Hi, Congratulations for your little and useful program!

I wonder if there is a way to force OpenFolderAndSelectItem to reuse the explorer.exe instance if called a second or third time. Currently it opens a new instance for each different folder, reusing it only if you call the same folder again.

I would like to have a way to always reuse the same instance (the last one used). Maybe something like:

OpenFolderAndSelectItem.exe -L "C:\Windows\System32"

Proposed operation: if OpenFolderAndSelectItem has already open an instance of explorer.exe, then it reuses that instance, if not, then it opens a new instance.

What for?

I use a mindmap application to organize thoughts, tasks and files, and I want an easy way to get a preview of those files. Currently I can use OpenFolderAndSelectItem for this task, but it populates my desktop with multiple explorer windows after a while.

I hope it can be easily done.

Thanks in advance

Edo

Raymai97 commented 1 year ago

Hi @EdoFro

Currently OpenFolderAndSelectItem simply calls Windows API SHOpenFolderAndSelectItems() to achieve what it does.

Hence, the behavior that you mentioned

Currently it opens a new instance for each different folder, reusing it only if you call the same folder again.

... was defined by Windows itself, not by the program.

I checked the API doc and didn't see a straightforward way to achieve what you requested.

When I have time, I would still try to look around, see if it's possible to reuse Explorer window without complicated/hacking code. If you have any finding/new thought, please share with me as well.

EdoFro commented 1 year ago

Hi @Raymai97 Thank you for responding so quickly.

I checked the API doc and didn't see a straightforward way to achieve what you requested.

Thanks anyway. I appreciate it.

When I have time, I would still try to look around, see if it's possible to reuse Explorer window without complicated/hacking code.

That would be great!

If you have any finding/new thought, please share with me as well.

I will. I have just basic knowledge in C#, but if I find something interesting/useful I will report it here.

Thanks

edo