gpt4 book ai didi

c++ - 从 Windows 开始菜单快速启动中删除 exe

转载 作者:太空宇宙 更新时间:2023-11-04 15:52:54 26 4
gpt4 key购买 nike

为了工作,我们有两个快捷方式安装到开始菜单,它们都指向同一个 exe(但第二个具有不同的命令行参数)。

有时 Windows 会选择第二个快捷方式显示在开始菜单热程序列表中,这很糟糕,因为它会导致应用程序的完整更新。

有没有办法告诉 Windows 不要在开始菜单列表中显示该快捷方式?

最佳答案

对,其实是陈峰just wrote about this :

You can set the System.App­User­Model.Exclude­From­Show­In­New­Install 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):

#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;
}

关于c++ - 从 Windows 开始菜单快速启动中删除 exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5025110/

26 4 0