Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hook into the explorer directory calls in windows to determine when a new directory is opened?

Tags:

c#

winapi

If you use a tool like Process Monitor, you can see that when a directory is opened, explorer.exe performs a DirectoryQuery. I don't know if DirectoryQuery is specific to procmon, but I'm trying to see if I can capture those calls within C#. Or determine if there are any Win32 APIs I can PInvoke to get this info.

enter image description here

There are other tools like Clover that also do this. The functionality I'm trying to replicate is basically the same as Clover. Where I would redirect new directories to my application instead of Explorer.

If anyone can point me in the right direction, I would greatly appreciate it.

like image 796
ernest Avatar asked Nov 02 '25 03:11

ernest


1 Answers

If you want to write your own File Explorer application then you can use the IExplorerBrowser object to do 90% of the work for you. Register a new default verb for the Directory and Folder ProgIds.

If you want to hook into Explorers File Explorer windows then you must implement a browser helper object (C# if you must) and tweak it so it only loads in Explorer.

DWebBrowserEvents2 will tell you about navigation events.

like image 149
Anders Avatar answered Nov 03 '25 19:11

Anders



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!