Reputation: 676
Is there a way to create advertived shortcuts (see MS Office Shortcuts for example) programmatically in C# or with WinAPI Functions?
I only found Methods to get/read infos from such shortcuts and the knowledge that MSI creates such shortcuts, but no ways to create them (without msi installer)
As a sideeffect of such shortcuttypes they are not editable in propertieswindow and I want to create such "uneditable" shortcuts (like MS Office does - I'm not really interested in other advertived shortcut features)
Upvotes: 0
Views: 654
Reputation: 24303
While you can't create MSI advertised shortcuts without involving Windows Installer, you can create shortcuts to any Shell namespace object (which is all Windows Installer does). This will require a shell extension DLL and custom code to actually create the shortcut in the first place.
See the MSDN Shell reference and this article for more details.
If you just want to provide delayed installation, you can make the shortcut point to a stub executable that triggers any checks and installation if required.
Upvotes: 1
Reputation: 55610
Not really. The target of an advertised shortcut is the keyfile of an installed product's component. This is so it can do a health check when you click it.
All of this is impossible to have that without having an MSI.
ShellAPI might expose a function that WindowsInstaller's CreateShortcut action is using but I'm sure it would take things like ProductCode and ComponentID as arguments.
Now if you were installed using MSI I suppose it might be possible use DTF to create a copy of the installed MSI, update the ShortCut table and recache the product resulting in the advertised shortcut being created. But I'm guessing that's not what you had in mind.
Upvotes: 2