How do specify that a shortcut should not be promoted as newly-installed on the Start menu?

Raymond Chen

Windows XP employed a number of heuristics to determine which Start menu shortcuts should be promoted when an application is newly-installed. But what if those heuristics end up guessing wrong?

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.”

#include <windows.h>
#include <tchar.h>
#include <shlobj.h>
#include <atlbase.h>
// class CCoInitialize 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;
}

0 comments

Discussion is closed.

Feedback usabilla icon