Computing.Net > Forums > Programming > Custom buttons for Windows Explorer

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Custom buttons for Windows Explorer

Reply to Message Icon

Name: Merrick
Date: September 12, 2006 at 10:47:54 Pacific
OS: XP Pro SP2
CPU/Ram: P4/2GB
Product: N/A
Comment:

Actually, for Windows Explorer and/or My Computer...

Can anyone point me at resources for developing customized buttons and adding them to the Windows Explorer and My Computer windows? This seems like a useful trick to know in general, but I can only find information for adding customized buttons to IE. My specific application at the moment is to produce a button which loads cmd.exe with the current path set to the same path currently in the address window.

Any suggestions would be greatly appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: Merrick
Date: September 12, 2006 at 15:34:07 Pacific
Reply:

A partial solution, on two fronts:

I really would like a good resource for the button solution, since it would theoretically offer infinite flexibility depending upon how hard one was willing to work. But I have in fact found a nearly full solution to the problem by editing the registry.

The original inspiration for this can be found at:
http://www.codeproject.com/shell/co...

In a nutshell, one adds two keys to the registry. First, a key is added to HKEY_CLASSES_ROOT\Folders\shell named CmdPrompt with a value set to "Command Prompt" (quotes not included). Second, a key is added to the new key named command with the value "c:\winnt\system32\cmd.exe" (quotes required, and the appropriate windows path subsituted for winnt as necessary).

This will do something *similar* to what I was hoping for. For instance, if I am in Windows Explorer, in a folder called c:\test, and I have a further subfolder named foo, I can right click on foo, a drop-down menu will appear with the entry "Command Prompt" included which when clicked will open a command prompt with the path set to c:\test.

This is a big improvement over a command prompt opening in c:\documents and settings\ etc., but isn't quite there. For instance, the more general circumstance one might be interested in is one in which a file named, for instance, myTest.bat was in the c:\test directory. One would like to right-click on myTest.bat, click on "Command Prompt" and have a command prompt open up with the path set to c:\test (i.e., the directory in which the file of interest resides). Unfortunately, this isn't possible with the above fix because myTest.bat is not a folder. And, in general, one will not have an extra subfolder like foo hanging around in their work folders. So what's one to do?
As a first guess, one could add the same two keys in the same way to HKEY_CLASSES_ROOT\Files\shell to get the same result. No dice! So what's going on here?

If one looks a little closer to the registry, one will see that besides the generic File key there are individual keys for all of the "known file types." So, for instance, there is a key named batfile. If one is adventurous and adds the appropriate two keys in the prescribed way to \batfile\shell WE will now respond exactly as desired for all .bat files.

For the time being, one could simply enter the appropriate two keys to every "known file type" key that one would be interested in having this fiunctionality for. That's probably not too daunting of a task, since one presumably would be interested in having this function for several programming file formats, several defined data file formats, and not much else. But it does leave the frustrating angst of suspecting one could set this up so that it was the default behavior for all file types.

If anyone has any ideas, please let me know.

Also, please don't forget about the original query. I'd still like to know how to develop and attach custom buttons to WE.

Thanks again, and I hope someone besides me finds this useful.



0

Response Number 2
Name: Merrick
Date: September 13, 2006 at 06:51:56 Pacific
Reply:

OK. This actually will get you the appropriate ability to open a command window by clicking on either a file or folder in a subdirectory in WE.

In the registry entry HKEY_CLASSES_ROOT\* add a key named shell. To this key add a key named CmdPrompt and set its value to "Command Prompt" (without the quotes). To this key add a key named command and set its value to "c:\winnt\system32\cmd.exe" (with the quotes, substituting the appropriate path for winnt depending on where you have windows installed).


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Custom buttons for Windows Explorer

Creating a custom button in IE7 Command Bar www.computing.net/answers/programming/creating-a-custom-button-in-ie7-command-bar/18936.html

custom button control www.computing.net/answers/programming/custom-button-control/5215.html

Custom Close, Minimize, etc buttons c++ www.computing.net/answers/programming/custom-close-minimize-etc-buttons-c/150.html