开发者

Programmatically access the "Open with" Windows Explorer menu list from .NET

开发者 https://www.devze.com 2022-12-15 19:46 出处:网络
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.

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.

See this picture as an example:

Programmatically access the "Open with" Windows Explorer menu list from .NET

(source: magerquark.de)

Now I want to be able to programmatically read the list of applications for a given file extension/type (e.g. "png") from within a C# .NET 2.0 application.

E.g.

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.

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

The Microsoft.Win32 API contains the classes to access the registry.

0

精彩评论

暂无评论...
验证码 换一张
取 消