另一种方法是直接写入列表.它在哪里?您可能已经发现固定项目位于:%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar而且它们是常规的、古老的捷径.你可以添加你自己的.它不会工作.固定的项目实际上是由组策略控制的.显然,这些快捷方式是后备.您需要弄乱 Windows 注册表.请参阅 如何使用组策略管理 Windows 任务栏项目固定.我想我们想要 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband 中的 Favorites 和 FavoritesResolve.嗯,它不是一个简单的列表,它是二进制的.我最好的猜测是它是某种打包格式的快捷方式文件的转储,祝你好运.我不会为你解决这个问题.此外,我敢打赌人们在这里找到它,开始利用它,然后 Microsoft 更改它,然后它不起作用.显然在某些时候有一种程序化的方式来做到这一点通过脚本将项目固定到开始菜单或 Windows 7 任务栏.这个想法是从快捷方式中获取一个 shell 对象并在其上运行Pin to Tas&kbar"动词.链接文章中提供的脚本.我不会详细介绍它,因为.... 它不再起作用:这是 Windows 客户端团队有意改变的行为.我相信 Windows 团队知道这些问题,但您可以通过 Windows 10 反馈应用提供反馈.您也可以在那里阅读:固定到开始"菜单或任务栏的项目是用户首选项.应用程序不应覆盖用户的偏好.从长远来看,将不支持以编程方式将项目固定到 Windows 10 中的任务栏或开始菜单.只有用户才能固定项目.显然它可以通过以管理员权限运行应用程序来工作,无法确认.无论如何,如您所见,没有任何保证.另见:该程序如何将自己固定到我的任务栏我什么时候安装的?.如果你真的必须这样做,正如陈雷蒙德所说,我希望你能拿到奖金.I want my application to be pinned to the taskbar when the user press the minimizing button of the form but I have no Idea how to do it or if it is possible my OS is windows 10...Thanks for your help 解决方案 When you minimize your window, by default, it will be minimized in the taskbar. Unless you have set it to not show there.If that is what you want, you have to do nothing. As per pinning it you should not do it.Don't ask for support for pinning, here is whyMicrosoft goes in great length to prevent applications altering user preferences. Why? Because otherwise, every application would do it. Giving access to user preferences via API means developers start exploiting it. It means applications fighting for screen space. You install compnay A product and it unpins company B product.If such API existed, imagine how easy would it be to write a "joke program" that replaces all your pins. Yes, that is malware.And no, an API for only the calling executable is not viable, it would mean that somewhere deep in the operating system the function call to do it for any executable exists. And then somebody finds it and calls it directly. Besides, it has been a big trouble for Microsoft to decouple the shell as it is.Instead explorer handles it.Further reading Why is there no programmatic access to the Start menu pin list?.Thus, the answer is "Please don't do it".But that other app did it...Alright, some application do manage to pin, how do they do it?Regardless of what it is I can tell you:It is a bad practice.It is not guaranteed to work, much less in the next Windows update.One way is to mimic user input. It is hard to consider all cases (what if the taskbar is hidden, what if it is not in the usual place, what if explorer is not running, etc.), but you can imagine setting the pointer position and sending keys.Another way would be to write directly to the list. Where is it? You might have found out that the pinned items are at:%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBarAnd they are regular, good old, shortcuts. And you could add your own. And it would not work.The pinned items are actually controlled by group policy. Apparently the shortcuts are a fallback. You would need to mess with Windows registry. See How to manage Windows Taskbar Items pinning using Group Policy. I guess we want Favorites and FavoritesResolve from HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband. Well, it is not a plain list, it is binary. My best guess is that it is a dump of the shortcut files in some packing format, good luck.I'm not figuring that out for you. Besides, I bet people find it here, start exploiting it, and then Microsoft change it, then it does not work.Apparently there was at some point a programmatic way to do it Pin Items to the Start Menu or Windows 7 Taskbar via Script. The idea was to get a shell object from the shortcut and run a "Pin to Tas&kbar" verb on it. Script provided in the linked article. I'm not going into detail on it because.... it does no longer work: it is an intentional change in behavior by the Windows client team. I believe the Windows team is aware of the concerns, but you can provide feedback via the Windows 10 Feedback app.You can also read there: The items that are pinned to the Start menu or taskbar is a user preference. Applications should not be overriding the user’s preferences. In the long term, programmaticaly pinning items to the taskbar or Start menu in Windows 10 will not be supported. Only the user will be able to pin items.Apparently it could work by running the application with administrator privileges, can't confirm. Regardless, as you can see, there are no guarantees.See also: How did that program manage to pin itself to my taskbar when I installed it?.If you really have to do it, as Raymond Chen would put it, I hope you get your bonus. 这篇关于如何将应用程序固定到任务栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-28 01:34