Solved

How to write shell extensions to hook context menu's "open" "copy" "cut"

Posted on 2006-07-24
5
414 Views
Last Modified: 2013-11-20
Hi, I want write a shell extensions to hook context menu's "open" "copy" "cut",
when user right-click on a file then choose open or copy or cut or transfer to,
I want it do my hook function first then do origin work.

Please give me some information, and code example,

Thanks for your help~
0
Comment
Question by:rocktilldie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17166501
Though I have not seen any hook implementation for this global file operations and also ICopyHook which available is only works for Folder and Printer objects....
But You may check out API SHChangeNotifyRegister() which sends notifications from the file system or shell about particular operation..this will help you to implement hook..

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shchangenotifyregister.asp

-MAHESH
0
 

Author Comment

by:rocktilldie
ID: 17173454
Hi, but seems SHChangeNotifyRegister() can't detect "copy file", "cut file" "open file" event, Could you give me example code? Thanks~
0
 

Author Comment

by:rocktilldie
ID: 17177938
I found someone want hook double click's solution
--------------------------------------------------------------------------------------------------------------------------
You have to implement IContextMenu (return the interface in GetUIObjectOf) and put a default item in it. Normally the flag CMF_DEFAULTONLY will be set, and then you add only your default command. Then in InvokeCommand you display your dialog.
Of course, nowadays it is advised to use CDefFolderMenu_Create2 for your context menu.
---------------------------------------------------------------------------------------------------------------------------
But I'm beginner to shell extension/COM, so can anyone give me sample code explain above solution?
Thanks~
0
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 500 total points
ID: 17190753
0
 

Author Comment

by:rocktilldie
ID: 17193616
Thanks, I'll use this example
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question