This is a mirror of official site: http://jasper-net.blogspot.com/

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

| Tuesday, February 15, 2011
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);


Read more: The old new thing

Posted via email from Jasper-net

0 comments: