Click here to Skip to main content
11,921,479 members (60,488 online)
Click here to Skip to main content
Add your own
alternative version


31 bookmarked

'Copy To' & 'Move To' in Shell Context Menu.

, 7 Jan 2001
Rate this:
Please Sign up or sign in to vote.
This article is all about how to create a context menu shell extension. 'Copy To' & 'Move To' will be added to the files/folder context menu.

Sample Image - ContMenuExt.gif


In Win2K you can see two new tool bar buttons in Windows Explorer: Copy To & Move To. Yet Microsoft hasn't realized to include these two entries in files/folders context menu. I wish for these entries in context menu because every time for copying or moving files/folders, I have to change the folders or have to push those new tool bar buttons in Win2K.

Following example will create those two entries in context menu.

I assume that you are familiar of creating shell extensions, COM, clipboard operation and Shell APIs. (Esposito Dino's book is very handy for any beginner shell programmer).

Follow all steps that are required to create a shell extension.

Following keys in registry will tell shell that, you are extending the files/folders context menu. Those are:


Don't be confused with text Mumtaz; that's my Name.

When user views the context menu of file/folders, shell starts the game of looking for any one who is extending the shell. That will include the difficult words like DllGetClassObject, IClassFactory, DllMain...

My concern is to tell you about IContextMenu, not all of it but Intialize and InvokeCommand.

First Initialize, it has the following prototype:

IContextMenu::Initialize (LPCITEMIDLIST pidlFolder, 
        LPDATAOBJECT lpdobj, HKEY hKeyProgID);

Our concern is the LPDATAOBJECT. We can retrieve the list of files/folders being selected through this data object pointer. This includes FORMATETC for clipboard format and STGMEDIUM for storage medium. You can study these two structures in detail on MSDN. We put the files/folders being selected, in a class member m_pszSource.

In Invoke command, we do the rest of the operation, yes, copying or moving. SHBrowseForFolder() help us for selecting destination, that will be a PIDL. We must convert it to a string for passing it to SHFileOperation as a destination path.

That's all.

I haven't included any details for creating shell extension, because you can read much about it on MSDN. For clipboard format and data object search try "Handling Shell Data Transfer Scenarios" on MSDN.


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


About the Author

Mumtaz Zaheer
Web Developer
Pakistan Pakistan
Mumtaz Zaheer is working as Senior System Analyst with Information Architects, Pakistan (

You may also be interested in...

Comments and Discussions

QuestionHow to creat menu on the basis of file extensions. Pin
studentkth20-Oct-09 1:55
memberstudentkth20-Oct-09 1:55 
AnswerRe: How to creat menu on the basis of file extensions. Pin
Mumtaz Zaheer20-Oct-09 2:13
memberMumtaz Zaheer20-Oct-09 2:13 
Generaladd menu for image files only Pin
kiranin1-Nov-06 20:02
memberkiranin1-Nov-06 20:02 
QuestionRemoving "Select" menu item from right click context menu on files and folders Pin
Reji_Kumar15-Dec-05 0:20
memberReji_Kumar15-Dec-05 0:20 
GeneralGreat Article Madame Pin
ThatsAlok27-Oct-04 21:02
memberThatsAlok27-Oct-04 21:02 
GeneralGet *.lnk File Path Pin
Miss Fress5-Apr-04 19:37
memberMiss Fress5-Apr-04 19:37 
QuestionHow can i recover it Pin
sophialili24-Mar-04 19:54
membersophialili24-Mar-04 19:54 
AnswerRe: How can i recover it Pin
Mumtaz Zaheer24-Mar-04 21:59
memberMumtaz Zaheer24-Mar-04 21:59 
GeneralRe: How can i recover it Pin
zhgfhz5-Jun-06 12:56
memberzhgfhz5-Jun-06 12:56 
Generalthank's Pin
icrmio13-Mar-03 22:57
membericrmio13-Mar-03 22:57 
Generalfile copying Pin
wolfs-bane7-Nov-02 0:18
susswolfs-bane7-Nov-02 0:18 
Questionwhat is the difference Pin
Anonymous20-Jul-01 3:22
memberAnonymous20-Jul-01 3:22 
AnswerRe: what is the difference Pin
Anonymous28-Aug-02 3:21
sussAnonymous28-Aug-02 3:21 
GeneralRe: error on IID_IShellExtInit and IID_IContextMenu Pin
Mumtaz Zaheer22-Jan-01 19:29
memberMumtaz Zaheer22-Jan-01 19:29 
GeneralCreating popup (sub menu)for Copy to Pin
kevinDougla18-Jan-01 15:13
memberkevinDougla18-Jan-01 15:13 
GeneralRe: Creating popup (sub menu)for Copy to Pin
Mumtaz Zaheer22-Jan-01 18:45
memberMumtaz Zaheer22-Jan-01 18:45 
GeneralRe: Creating popup (sub menu)for Copy to Pin
Mumtaz Zaheer12-Feb-01 23:52
memberMumtaz Zaheer12-Feb-01 23:52 
GeneralWin2k already supports this Pin
Matthew Ellis8-Jan-01 4:11
memberMatthew Ellis8-Jan-01 4:11 
GeneralRe: Win2k already supports this Pin
Steven J. Ackerman8-Jan-01 4:29
memberSteven J. Ackerman8-Jan-01 4:29 
GeneralRe: Win2k already supports this Pin
Mumtaz Zaheer9-Jan-01 0:58
memberMumtaz Zaheer9-Jan-01 0:58 
GeneralRe: Win2k already supports this Pin
Anonymous22-Jan-01 21:00
memberAnonymous22-Jan-01 21:00 
GeneralRe: Win2k already supports this Pin
Anonymous13-Oct-01 0:30
memberAnonymous13-Oct-01 0:30 
GeneralRe: Win2k already supports this Pin
Anonymous17-Feb-02 19:48
memberAnonymous17-Feb-02 19:48 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151120.1 | Last Updated 8 Jan 2001
Article Copyright 2001 by Mumtaz Zaheer
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid