Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-07-24
5
Medium Priority
?
434 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
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 1500 total points
ID: 17190753
0
 

Author Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

916 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