The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

mouse click event in explorer

Would it be possible to write an application to capture the mouse click events on files and folders in windows explorer with C# or C++?
coder
Thursday, March 13, 2008
 
 
Yes.

Is that the end of this thread? (Crickets chirping)
Robby Slaughter Send private email
Thursday, March 13, 2008
 
 
Could you explain how it can be done?

I know how I can capture the mouse, but not sure how to figure out which window/process it is pointing at, and then extracting what exactly is under the mouse (file/folder)
coder
Thursday, March 13, 2008
 
 
google "explorer shell extension"
BillAtHRST
Thursday, March 13, 2008
 
 
IIRC, a Shell Explorer Extension only lets you react to a right-mouse click, just before it's ready to show the context menu. (I could be wrong; it's been a while since I did anything with this stuff.)
Ken White Send private email
Thursday, March 13, 2008
 
 
What do you actually want to do?

You can probably use the low-level Windows hooks APIs to grab the mouse clicks, but if we know what you actually want to do  (as opposed to how you want to do it) there may be an easier way to solve the problem.
Chris Tavares Send private email
Thursday, March 13, 2008
 
 
You know how you can monitor files and folders for changes? I want to monitor them for being clicked in windows explorer.
coder
Thursday, March 13, 2008
 
 
@coder:
Why?

If we know what you want to achieve, it'll be much easier to answer your question.
Odysseus Send private email
Friday, March 14, 2008
 
 
Don't forget that users can open folders and select items in Explorer without clicking. They can just use the keyboard.

You still aren't being clear about what you want to do. A user single clicking on folders usually doesn't have any effect and may not correlate to any real action. Do you want to trap single clicks? Double clicks? Are you trying to monitor folder usage or programs being launched? If so, my first comment above about using the keyboard as well might tell you that monitoring mouse clicks is probably not the correct approach.
dood mcdoogle
Friday, March 14, 2008
 
 
How about this then:

Would it be possible to add another section to the windows explorer bar? (Look at this link to see what I mean by "explorer bar": www.codeproject.com/KB/miscctrl/collapsiblepanelbar.aspx)
coder
Saturday, March 15, 2008
 
 
It is the bar that shows up in XP windows explorer(I think it is in 2000 too) when neither "search" nor "folder" is selected.
coder
Saturday, March 15, 2008
 
 
Is there a reason why you don't want to implement whatever functionality you are looking for in the standard manner? In other words, using a right-click context menu addition. Something like the way TortoiseSVN works?

And if you intend to continue to be so secretive, then we will too. I'm going to keep the answer to your question very secret because you clearly don't understand how to get the help you need. When you go to the doctor with a problem do you just make him/her guess what could possibly be wrong? When you go to a restaurant do you make the waiter/waitress guess what you are hungry for?

Nobody out here is going to steal your sacred idea. Ideas are a dime a dozen.
uggh
Saturday, March 15, 2008
 
 
I am not being secretive. I already explained what I am trying to do. Why do I have to have an ulterior motive?
coder
Sunday, March 16, 2008
 
 
You have been given an answer already. If you want to extend Explorer the only way to do so is with a shell extension. Google for it and you will soon learn what you can and can't do.
dood mcdoogle
Sunday, March 16, 2008
 
 
ok thanks
coder
Sunday, March 16, 2008
 
 
The long way to do this would be with a global mouse/keyboard hook and then a function such as AccessibleObjectFromPoint to get details about what was clicked on. with a few additional Window/Process checks you could achieve what you want.
Adrian
Monday, March 17, 2008
 
 
You do not understand, "coder".

Yes, you have explained "what" you want to do.  You have not explained "why".  Asking for that "why" is not accusing you of having an ulterior motive -- asking for that "why" is trying to get a little more information so that we can provide you better answers.

It would be like you asking us "where's the oil cap on my car?" -- and we ask why, and you say "because I have to change my oil", and we ask why you think you need to change your oil.

Maybe you'll say "because it's been 3,000 miles and it's time to change it" -- which tells us you're doing it for the right reason.  Maybe you'll say "because my oil has turned green" -- which means you've been looking in the radiator and are about to change out your antifreeze for oil, which would be a bad thing.

The car analogy is stupid, I admit, but I see this sort of thing all the time in Software.  People ask "How do I do 'A'?" when they're actually trying to solve a completely different problem that they THINK doing 'A' will solve, only it won't, but they don't know that.  Yet.

That's why we ask for more information.
AllanL5
Monday, March 17, 2008
 
 
This is a classic example of failure to distinguish between a problem and a solution. 

Capturing mouse clicks in an Explorer window is a solution, but to what problem? 

If you can't or won't describe the problem, well fine, but then you've already got your answers:
- use a shell extension, and abide by the rules, or
- install a system-wide windows hook to capture all mouse events and do whatever you want.
BillAtHRST
Monday, March 17, 2008
 
 
@AllanL5:

Let me deal with what problem to solve. That's how people learn, right? I don't want any hand-holding at this point. If I get stuck, I'll come back and ask something else.

@BillAtHRST:

Yup, I got my options. Thanks.
coder
Tuesday, March 18, 2008
 
 
A few years ago I had someone ask me something similar - how to use Excel formulas in VBA. I asked him why he needed to know but he just got annoyed. Knowing that he was on his way to coding a WTF but not really caring, since he has such an attitude problem, I gave him the answer. Use the "Excel.WorsheetFunction" object.

What did I see from him a few months later? A whole raft of "code" that instead of:
a = 5+7
would have
a = Excel.WorksheetFunction.Sum(5, 7)

I get the feeling that I'm seeing something the same thing here.
squibble
Tuesday, March 18, 2008
 
 
"shell extension" is what I was looking for. Thanks for all the replies and the concerns.
coder
Tuesday, March 18, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz