Solved

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

Posted on 2006-07-24
5
369 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
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:mahesh1402
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
0
 

Author Comment

by:rocktilldie
Comment Utility
Thanks, I'll use this example
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now