c# - Register context menu verbs for specific file types -
i'm registering extended verbs video file types on system doing this:
foreach (var ext in filetypes.videotypes) { var progid = registry.getvalue($@"hkey_classes_root\.{ext}", null, null); if (progid == null) { continue; } registry.setvalue( $@"hkey_current_user\software\classes\{progid}\shell\dlsub", null, "download subtitle"); registry.setvalue( $@"hkey_current_user\software\classes\{progid}\shell\dlsub\command", null, @"""d:\myapp.exe"" ""%1"""); }
resulting in (mpeg_auto_file
mkv
):
[hkey_classes_root\mpg_auto_file\shell\dlsub] @="download subtitle" [hkey_classes_root\mpg_auto_file\shell\dlsub\command] @="\"d:\\myapp.exe\" \"%1\""
and mplayerc.mp4
mp4
:
[hkey_classes_root\mplayerc.mp4\shell\dlsub] @="download subtitle" [hkey_classes_root\mplayerc.mp4\shell\dlsub\command] @="\"d:\\myapp.exe\" \"%1\""
the problem registered verb shows mkv
(and couple of other filetypes), context menus other file types (like mp4
) unaffected. adding verb hkey_classes_root\*\shell
work these filetypes, not want!
any ideas on difference between these filetypes? perhaps has registered progid (all mplayerc
types not seem work...).
the default value (aka progid
) can found specific file extension doesn't point correct class (the 1 affect menu entries). during tests, on fresh copy of windows 10 - wmp11.assocfile.avi
progid
.avi
file extension, when added entry in wmp11.assocfile.avi\shell\
(either hkey_local_machine
or hkey_current_user
) didn't affect menu @ all. give found hkey_classes_root\.avi\openwithprogids
store few more values, including wmp11.assocfile.avi
other starts word app, i.e. appx6eg8h5sxqq90pv53845wmnbewywdqq5h
. editing shell\
one, able add menu entry. downside - affected other file extensions somehow linked appx6eg8h5sxqq90pv53845wmnbewywdqq5h
. couldn't accept solution force me iterate through classes found in openwithprogids
, plus menu entry had shown specific file extensions , not other. decided go hkey_classes_root\*\shellex
, dlls create menu entry dynamically, based on clicked file type (check extension).
Comments
Post a Comment