Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / C++
Article

A Context Menu Handler for Windows Users That Can't Let Go

Rate me:
Please Sign up or sign in to vote.
4.79/5 (13 votes)
31 May 20062 min read 126.2K   2.2K   39   22
A context menu handler that makes it easier to work with paths, command windows, and program arguments from within Explorer.

Screenshots

Introduction

I wrote CMDCMX back in 1996. I have found similar implementations but nothing quite as useful as my own. Everyone I share it with seems to love it, so I figured I would update it and post it.

As a code example: CMDCMX demonstrates using afxCurrentResourceHandle and afxCurrentInstanceHandle globals which is sometimes required when using MFC from within Windows shell extensions. There are some other cool things in there, but nothing earth shattering.

As a utility: CMDCMX allows you to open a command window with the current working directory set to the folder you right-clicked on in Explorer. CMDCMX also allows you to copy both the long and short versions of a file, or folder path to the clipboard from within Explorer. Lastly, CMDCMX allows you to easily launch executable files with command line arguments from within Explorer.

Using the Utility

The pre-built utility requires two MS redistributables: mfc71u.dll and msvcr71.dll. If the MS files do not already exist on your system (they are installed by VC 7.1), then they should be copied to the same directory as the CMDCMX files. You can download the MS files here:

Using the Code

The project is all self-contained. After extracting the source, open the cmdcmx.vcproj file with VC 7.1. Select either the Release or the Debug target. Build the project.

Look for afxCurrentResourceHandle and afxCurrentInstanceHandle in cmdcmx.cpp to see an example of how they are used.

Points of Interest

The project also includes a sub-project to build a configuration utility for CMDCMX. Called cmdcmxcfg.exe, the application allows selection of menu items to add. In addition, the application allows selection of the command interpreter to be used.

History

  • Version 1.00, posted October 1, 2003

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
16yrs of GUI programming experience gained at: (most recent first) BlackBall, Veritas, Seagate Software, Arcada, Stac, Mountain, and Emerald Systems.

Languages/Scripting: C, C++, JAVA, BASIC, JAVASCRIPT, HTML, XML, PHP, and SQL

Tools: MS Visual Studio, MS Visual SourceSafe, CVS, PVCS, Bounds Checker, VMWare, ToDoList, InstallShield, and Office Applications

Libraries and API: RTL, STL, WIN32, MFC, ATL, .NET, ActiveX, DirectX, COM, DCOM, Shell Extensions, and Shell Namespaces

Strengths: Honest, communicative, keen eye for usability, good at estimating workload and completion dates, ready to take on grunt work, team player, experienced working with QA, localization, Tech Pubs, Sales, and Marketing teams.

Comments and Discussions

 
QuestionCan I use icon instead of bitmap ? Pin
Ventruing21-Jun-05 23:11
Ventruing21-Jun-05 23:11 
AnswerRe: Can I use icon instead of bitmap ? Pin
Shaun Harrington22-Jun-05 5:23
Shaun Harrington22-Jun-05 5:23 
QuestionDesktop menu? Pin
dragomir9-Apr-04 0:04
dragomir9-Apr-04 0:04 
AnswerRe: Desktop menu? Pin
Jeremy Stanley28-Apr-04 5:48
Jeremy Stanley28-Apr-04 5:48 
General"Open in command window" suggestion Pin
mikerj24-Feb-04 23:04
mikerj24-Feb-04 23:04 
GeneralCouldn't compile in VC 6.0 Pin
Arshad Parvez1-Jan-04 4:28
Arshad Parvez1-Jan-04 4:28 
Generalsuggestions Pin
vherva15-Oct-03 2:51
sussvherva15-Oct-03 2:51 
GeneralRe: suggestions Pin
Anonymous16-Jan-04 6:56
Anonymous16-Jan-04 6:56 
GeneralQuit Cool, also see... Pin
AllenR8-Oct-03 21:57
professionalAllenR8-Oct-03 21:57 
GeneralNice 'n' great but... Pin
Member 13556275-Oct-03 11:17
Member 13556275-Oct-03 11:17 
...i've seen all kinds of context menu handlers
but none to allow the user to insert a new menu
entry easily and flexibly. I hope there is something like
this out there but i havent seen it so far.
OS/2 has this since ages but then os/2 has an
OO shell so the user can efectively say
'when this menu entry that i just added to this
particular menu is invoked do this' where 'this' is
whatever he can do with the shell via direct manipulation
(usually through the mouse).
Since explorer isnt that OO (on 21st century? ouch!)
someone could make a tool to allow the user to insert the
menu entry at the menu of her choice and at minimum allow
her to fire up her command from there, which could be an
.exe, a script etc etc. Plus, since many of the operations
explorer does are performed through a 'rundll' call with
some bizzare parameters the tool could include as many as
possible of these to allow maximum shell integration with
the user menu entry invocation. Tc

GeneralRe: Nice 'n' great but... Pin
Shaun Harrington6-Oct-03 4:19
Shaun Harrington6-Oct-03 4:19 
GeneralVery nice! Pin
Tom Hunter5-Oct-03 1:28
Tom Hunter5-Oct-03 1:28 
GeneralRe: Very nice! Pin
Shaun Harrington5-Oct-03 6:44
Shaun Harrington5-Oct-03 6:44 
GeneralError registering dll in win2k Pin
Atif Mushtaq3-Oct-03 0:38
Atif Mushtaq3-Oct-03 0:38 
GeneralRe: Error registering dll in win2k Pin
Shaun Harrington3-Oct-03 5:55
Shaun Harrington3-Oct-03 5:55 
GeneralRe: Error registering dll in win2k Pin
Shaun Harrington3-Oct-03 8:00
Shaun Harrington3-Oct-03 8:00 
GeneralRe: Error registering dll in win2k Pin
Shaun Harrington3-Oct-03 9:22
Shaun Harrington3-Oct-03 9:22 
GeneralRe: Error registering dll in win2k Pin
Shaun Harrington4-Oct-03 5:13
Shaun Harrington4-Oct-03 5:13 
GeneralRe: Error registering dll in win2k Pin
WREY5-Oct-03 8:46
WREY5-Oct-03 8:46 
GeneralRe: Error registering dll in win2k Pin
Shaun Harrington5-Oct-03 11:16
Shaun Harrington5-Oct-03 11:16 
GeneralMissing DLLs Pin
Anthony_Yio2-Oct-03 15:36
Anthony_Yio2-Oct-03 15:36 
GeneralRe: Missing DLLs Pin
Shaun Harrington2-Oct-03 17:15
Shaun Harrington2-Oct-03 17:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.