Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open more than 15 Files by Context Menu without MultipleInvokePromptMinimum

I have already added a right click option to open files with my c++ program:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Open With MyProgram]
"Icon"="\"C:\\Program Files (x86)\\myProgram.exe\""

[HKEY_CLASSES_ROOT\*\shell\Open With MyProgram\command]
@="\"C:\\Program Files (x86)\\myProgram.exe\" \"%1\""

This is working just fine. When I select more than 15 files the right click option disappears. I already read about the following method with MultipleInvokePromptMinimum:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"MultipleInvokePromptMinimum"=dword:00001388

This would do the job, the only problem is that I dont want to enable other "open" or "print" right click options for more than 15 files, just my custom one.

(The "Edit with Notepad++" right click option for example is enabled for more than 15 files without changing the MultipleInvokePromptMinimum)

Whats the best way to achieve this? Thanks in advance.

like image 669
tk_ Avatar asked Oct 17 '22 13:10

tk_


1 Answers

As you have already figured out from the comments, a plain static verb has a limit that can be bumped up to 100 by setting MultiSelectModel to player. Explorer only allows COM based shell extensions to go beyond this limit.

There are multiple types of shell extensions you could implement depending on your minimum supported Windows version:

  • IExecuteCommand is the least amount of work but it is only usable on Windows 7 and later. Tutorial/example can be found here.

  • IDropTarget needs a full COM server but works on Windows XP and later. Tutorial/example can be found here.

  • IContextMenu registered under ShellEx\ContextMenuHandlers works on every Windows version but the selection limit does not exist on these old systems so there is no need to implement this in your case.

It is recommended that you write your extension in C/C++ or Delphi and not in a .NET language like C# (this is a recommendation or requirement depending on the Windows and .NET version).

like image 106
Anders Avatar answered Oct 20 '22 13:10

Anders