简体   繁体   English

从 .NET 以编程方式访问“打开方式”Windows 资源管理器菜单列表

[英]Programmatically access the “Open with” Windows Explorer menu list from .NET

When right-clicking a file in Windows Explorer, the "Open with" menu item displays a list of available applications, based on the file type of the clicked file.在 Windows 资源管理器中右键单击文件时,“打开方式”菜单项根据单击文件的文件类型显示可用应用程序列表。

See this picture as an example:以这张图片为例:

Windows 资源管理器中的“打开方式”上下文菜单
(source: magerquark.de ) (来源: magerquark.de

Now I want to be able to programmatically read the list of applications for a given file extension/type (eg "png") from within a C# .NET 2.0 application.现在我希望能够从 C# .NET 2.0 应用程序中以编程方式读取给定文件扩展名/类型(例如“png”)的应用程序列表。

Eg例如

public class FileOpenInfo
{
    public string ApplicationName { get; }
    public string ApplicationPath { get; }

    public static FileOpenInfo[] GetInformation( string extension );
}

Question:问题:

Is it possible to get this list?有没有可能得到这个列表?

The list of programs associated with a file extension are stored in the Windows Registry.与文件扩展名关联的程序列表存储在 Windows 注册表中。

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts

The Microsoft.Win32 contains the classes to access the registry. Microsoft.Win32 包含访问注册表的类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM