简体   繁体   English

如何使用 C# 在任务栏中获取固定应用程序列表

[英]How to get the list of pinned applications in taskbar using C#

I'm creating a windows application in c#, where automating windows.我在 c# 中创建了一个 windows 应用程序,其中自动化 windows。 And I'm trying retrieve all/list of the pinned applications in the taskbar.我正在尝试检索任务栏中固定应用程序的所有/列表。

I searched on internet, but I didn't get any suitable solution.我在互联网上搜索,但没有找到任何合适的解决方案。

Can anyone please help me.任何人都可以帮助我。

Thanks in advance.提前致谢。

Using file browsing, you can find pin taskbar shortcut here :使用文件浏览,您可以在此处找到固定任务栏快捷方式:

%AppData%\\Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar %AppData%\\Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar

Credit to Cagliostro and Steven Penny归功于 Cagliostro 和 Steven Penny

Source : https://superuser.com/questions/171096/where-is-the-list-of-pinned-start-menu-and-taskbar-items-stored-in-windows-7来源: https : //superuser.com/questions/171096/where-is-the-list-of-pinned-start-menu-and-taskbar-items-stored-in-windows-7

Quick usage will be like :快速使用将如下所示:

private void DisplayPinnedTaskBarElements()
{
    var pinnedTaskBarItemsPath = Environment.ExpandEnvironmentVariables(@"%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar");
    var pinnedTaskBarFiles = Directory.GetFiles(pinnedTaskBarItemsPath);
    
    foreach (var file in pinnedTaskBarFiles)
    {
        FileInfo fileInfo = new FileInfo(file);
        Console.WriteLine(fileInfo.Name);
    }
}

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

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