How to capture a user with the left mouse button in Windows Explorer?

From what I read, the shell extension is called when the user right-clicks the file in Windows Explorer. Is there a way to capture an event or trigger a shell extension when the user left-clicks on a file?

I need to keep track of the files that the user selects when he selects them. Is it possible?

Thank you for your help.

+4
source share
1 answer

First, use WinApi to check which window has focus. Is this an explorer window? Make sure that this is the type of window you are looking for by checking its attributes. And if so, check when the user clicks the left mouse button using GetAsyncKeystate, which notices the input all .

When you get the left mouse button, select the time to check if the user clicked on the file view. Go through the elements of the GUI window until you find someone who has keyboard focus. Get the container / frame ID for the file list using Spy ++. Now check if the focused / selected element is inside this frame and, most importantly , if it is a list item . Get the name / caption attribute of the element, and you're done!

I hope you understand that because of the length of this process, I cannot and will not give you the complete code to do this ... Tell me if there is something that you do not understand.

0
source

Source: https://habr.com/ru/post/1446281/


All Articles