如何使用 DelegateExecute 打开默认应用程序?

How do i open the default application using DelegateExecute?

我想使用用户在 his/her 计算机中设置的默认应用程序打开一个 jpg 文件。

jpg 文件的程序 ID 来自:

Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice

是“AppX43hnxtbyyps62jhe9sqpdzxn1790zetc”。当我从 :

检查 shell 命令时
Computer\HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\open\command

我得到 {4ED3A719-CEA8-4BD9-910D-E252F997AFC2} 的 DelegateExecute 值。我如何检索此应用程序的 shell 命令?

要在用户默认程序中打开文件,请使用 ShellExecute。如果要强制使用特定的 ProgId,请使用 ShellExecuteEx

您不应该自己阅读注册表。 DelegateExecute 是可以注册文件类型命令的 5 种(大概)方式之一(其他包括 ShellEx 扩展、DDE 和 DropHandler)。

如果您仍想自己执行此操作,请将字符串转换为 GUID,然后在创建 IExecuteCommand. You basically have to implement the other side of this.

的 COM 实例时将其用作 CLSID