views:

314

answers:

2

Related:

How to add new items to right-click event on Folders and Files in Windows?

I added custom right-click verb to all files by adding registry keys to HKEY_CLASSES_ROOT\*. End result looks like this

HKEY_CLASSES_ROOT*\Shell\TestRightClick\Command

-------Default = c:\RightClickTest.exe "%1"

Problem: when selecting multiple files c:\RightClickTest.exe will be called several times(number of selected files)

What I need: pass-in multiple files paths to one executable

+1  A: 

As I stated in the previous question, you're going to have to be intelligent about this inside your application. One instance of the program will be launched per file selected if you're not using a shell extension. Your general strategy could be this:

  1. When the application is launched with a file parameter (%1), check if any instance of the application are already running.
  2. If another instance is running, open some sort of Inter-Process Communication (IPC) channel to that application.
  3. Communicate the file parameter of this instance to the main instance.
  4. Write logic in the main program to address receiving this information as it's running.
Factor Mystic
A: 

For the purposes of my question at (http://superuser.com/questions/54379/creating-context-menu-item-for-multiple-files) I'm using a different compare program... instead of using WinMerge (free) my company bought us copies of UltraCompare (not free) ... it has a context menu item that does exactly what I want.

Sorry :( dont think this helps you but wanted to provide information anyhow...

M Murphy