Kev*_*ose 16
不要这样做.
我99%肯定没有官方API,原因与没有以编程方式访问旧的开始菜单的引脚列表完全相同.
简而言之,大多数用户不希望程序将垃圾放入他们的收藏夹,快速启动,任务栏等等,因此Windows不支持您这样做.
我正在尝试实现一个VirtuaWin(开源虚拟桌面软件)插件,它允许我将不同的按钮固定到不同的虚拟桌面.使用此完全有效的理由.
找到了固定它的方法:
以下代码片段取自Chromium shortcut.cc文件,几乎没有变化,另请参阅MSDN上的ShellExecute函数
bool TaskbarPinShortcutLink(const wchar_t* shortcut) {
int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarpin", shortcut,
NULL, NULL, 0));
return result > 32;
}
bool TaskbarUnpinShortcutLink(const wchar_t* shortcut) {
int result = reinterpret_cast<int>(ShellExecute(NULL, L"taskbarunpin",
shortcut, NULL, NULL, 0));
return result > 32;
}
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Run Code Online (Sandbox Code Playgroud)
如果你知道快捷方式,看起来很简单.对我而言,虽然这还不够,但我还需要迭代现有的按钮并取消固定并在不同的桌面上重新制作它们.
该文件夹包含固定应用程序的快捷方式
C:\Users\您的用户名\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar