Solved

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

Posted on 2006-07-24
5
403 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 500 total points
ID: 17190753
0
 

Author Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Suggested Solutions

Title # Comments Views Activity
List out all word 7 320
matchUp  challenge 6 70
withoutTen challenge 14 132
matchUp  challenge 9 116
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.

821 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