Marking a shortcut to say that it should not be placed on the Windows 8 Start page upon installation or treated as a newly-installed application

Today's Little Program creates a shortcut on the Start menu but marks it as "Do not put me on the front page upon installation." This is something you should do to any secondary shortcuts your installer creates. And while you're at it, you may as well set the "Don't highlight me as a newly-installed program" attribute used by Windows 7. (Remember, Little Programs do little to no error checking.)

#define UNICODE
#define _UNICODE
#define STRICT
#include <windows.h>
#include <shlobj.h>
#include <atlbase.h>
#include <propkey.h>
#include <shlwapi.h>

int __cdecl wmain(int, wchar_t **)
 CCoInitialize init;

 CComPtr<IShellLink> spsl;

 wchar_t szSelf[MAX_PATH];
 GetModuleFileName(GetModuleHandle(nullptr), szSelf, ARRAYSIZE(szSelf));

 CComQIPtr<IPropertyStore> spps(spsl);

 pvar.vt = VT_UI4;
 spps->SetValue(PKEY_AppUserModel_StartPinOption, pvar);

 pvar.vt = VT_BOOL;
 pvar.boolVal = VARIANT_TRUE;
 CComQIPtr<IPropertyStore> spps(spsl);
 spps->SetValue(PKEY_AppUserModel_ExcludeFromShowInNewInstall, pvar);


 wchar_t szPath[MAX_PATH];
 SHGetSpecialFolderPath(nullptr, szPath, CSIDL_PROGRAMS, FALSE);
 PathAppend(szPath, L"Awesome.lnk");
 CComQIPtr<IPersistFile>(spsl)->Save(szPath, FALSE);

 return 0;

First, we create a shell link object.

Next, we tell the shell link that its target is the currently-running program.

Now the fun begins. We get the property store of the shortcut and set two new properties.

We then commit those properties back into the shortcut.

Finally, we save the shortcut.

Comments (15)
  1. Erik says:

    But for a real installer you should use an installer builder, eg. WiX

  2. EduardoS says:


  3. Dan Bugglin says:

    @EduardoS My psychic debugging tells me it's probably defined in propkey.h, part of the Windows API, which you can install separately from Visual Studio if you don't have it.

  4. Dan Bugglin says:


    Though now that I think about it, not having the SDK doesn't make much sense, especially if the rest of the code seems OK to you.

  5. Nick says:

    @The MAZZTer: I think EduardoS's point was that VS 2012 pins a LOT of things to the Start screen. Which it does.

  6. Chris Smith says:

    For anyone wanting to use this in an MSI installer, using the property key name will cause an error; you need to use the GUID instead:…/2745126

  7. Anon says:

    Can you invent a time machine and tell the Visual Studio 2010 and Visual Studio 2008 installer writers about this?


  8. JM says:

    I had the hardest time parsing NOPINONINSTALL as "no pin on install". No opinion? No pinonin stall? What?

    I understand, though — underscores are a precious resource to be used for namespace/type disambiguation only. Separating common words is something you're expected to do yourself, much like the ancient Romans did.

  9. Anonymous says:

    Note that the APP­USERSUPER­MODEL_START­PIN­OPTION_PINUPONWALL option is common in the U.S. military.

  10. David Walker says:

    @Chris Smith: According to my reading of the linked support article, you're not completely correct.  Using the property key name will cause an error *in Windows 7*.  

  11. Me says:

    Nice of you to tell us, but this ought to have been a feature of the now non-existent deployment project. So, we can either write more code, or take deal with the XML madness of WiX.

  12. HDS says:

    Wix is great IF you figure out how it works – but unfortunately the developers are so busy writing code that they are unable to write decent documentation.

  13. Me says:

    Wix is great IF you figure out how it works

    Exactly. And Rob has left to set up his own consultancy on it! :)

    Why didn't MS invest some time and effort on making it useful to mere mortals without dedicated installation teams?

  14. xpclient says:

    And for "legacy" apps which haven't been updated (and will possibly never be updated) to set "System.App­User­Model.Start­Pin­Option", use AutoPin Controller:

  15. user says:

    ah, Windows 8, you know, back in windows 7, in case of file name collisions, I could tell Windows to rename files right in the copy dialog. now with windows 8 I'm 3 clicks away from that. Progress!

Comments are closed.

Skip to main content