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.
Is there a way to tell windows not to show that shortcut in the start menu list?
Yes, in fact Raymond Chen just wrote about this:
You can set the
System.AppUserModel.ExcludeFromShowInNewInstall
property toVARIANT_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."
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;
}