对于工作,我们有两个快捷方式安装到开始菜单,两个指向同一个exe(但第二个具有不同的命令行参数)。
For work we have two shortcuts that get installed to the start menu with both of them pointing to the same exe (but the second with different command line arguments).
有时候窗口会选择第二个快捷方式显示在开始菜单的热门程序列表中,这是不好的,因为它会导致应用程序的完全更新。
Some times windows will pick the second shortcut to display in the start menu hot program list which is bad because it causes a full update of the application.
有没有办法告诉windows不要在开始菜单列表中显示这个快捷方式?
Is there a way to tell windows not to show that shortcut in the start menu list?
推荐答案是的,事实上Raymond Chen 刚刚写了这篇文章:
Yes, in fact Raymond Chen just wrote about this:
您可以设置 System.AppUserModel.ExcludeFromShowInNewInstall 属性到 VARIANT_TRUE 来告诉开始菜单,我不是程序的主要入口点;我是辅助快捷方式,如帮助文件。
You can set the System.AppUserModel.ExcludeFromShowInNewInstall property to VARIANT_TRUE to tell the Start menu, "I am not the primary entry point for the program; I'm a secondary shortcut, like a help file."
示例代码( CCoInitialize class ):
Sample code (CCoInitialize class):
#include <windows.h> #include <tchar.h> #include <shlobj.h> #include <atlbase.h> // class 3CCoInitialize incorporated here by reference int __cdecl _tmain(int argc, TCHAR **argv) { // error checking elided for expository purposes CCoInitialize init; CComPtr<IShellLink> spsl; spsl.CoCreateInstance(CLSID_ShellLink); spsl->SetPath(TEXT("C:\\Program Files\\LitWare\\LWUpdate.exe")); PROPVARIANT pvar; pvar.vt = VT_BOOL; pvar.boolVal = VARIANT_TRUE; CComQIPtr<IPropertyStore>(spsl)->SetValue(PKEY_AppUserModel_ExcludeFromShowInNewInstall, pvar); CComQIPtr<IPersistFile>(spsl)->Save(L"LitWare Update.lnk", TRUE); return 0; }更多推荐
从windows启动菜单中删除exe快速启动
发布评论