1

Ive been reading all day and night, on how to make windows explorer add your custom menu in the context menu when right clicking on multiple files.

Whats the process would the shell extension pass selected files to let say my c# wpf program and get these all paths?

And to package my program, does it mean I have to package both my program and the shell extension together so they are both installed and can work hand in hand together?

Ive been spending hours and hours trying to get my head of the process to implement it.

Chopnut
  • 607
  • 2
  • 8
  • 25

1 Answers1

2

Shell extension receives initialization with IShellExtInit::Initialize call, where it's given an IDataObject* argument with CF_HDROP shaped data, which is used by shell extension with DragQueryFile API (see How to Drag and Drop multiple files between Namespace extensions) to access multiple file paths.

Once shell extension extracted the file paths, and you need it to pass the collection to an application you supposedly launch from the shell extension, you are free to define your own method of passing the strings further. For example, you can format a command line from the path strings, or write paths to a temporary file then pass its name as a command line argument.

When you want to pass the strings to already running application, you might want to use WM_COPYDATA message (see Use WM_COPYDATA to send data between processes) or alternative IPC method.

Community
  • 1
  • 1
Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • i see , to create a temporary file that holds the collection and pass the path string to the command line args. That could work, I was thinking in the line of formating all paths to a comma delimeted text and pass to %1. But worried that the string would be too small to accomodate the data. Cool – Chopnut Mar 21 '17 at 19:28