WinShell plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(Created page with "{{PageAuthor|Anders}} == Plugin Info == * '''Version:''' 20110223 * '''Type:''' Runtime plugin * '''Character encoding:''' Ansi * '''Minimum OS:''' Win95/NT4 * '''Minimum NSIS V...") |
(System plug-in alternative) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
== Plugin Info == | == Plugin Info == | ||
* '''Version:''' | * '''Version:''' 20121005 | ||
* '''Type:''' Runtime plugin | * '''Type:''' Runtime plugin | ||
* '''Character encoding:''' Ansi | * '''Character encoding:''' Ansi & Unicode | ||
* '''Minimum OS:''' Win95/NT4 | * '''Minimum OS:''' Win95/NT4 | ||
* '''Minimum NSIS Version:''' 2.0 | * '''Minimum NSIS Version:''' 2.0 | ||
* '''License:''' Freeware | * '''License:''' Freeware | ||
* '''Download:''' <attach>WinShell. | * '''Download:''' <attach>WinShell.zip</attach> | ||
== Information == | |||
SetLnkAUMI sets the PKEY_AppUserModel_ID property on a shortcut. | |||
UninstAppUserModelId calls IApplicationDestinations::RemoveAllDestinations and ICustomDestinationList::DeleteList. | |||
UninstShortcut calls IStartMenuPinnedList::RemoveFromList. | |||
== Usage Example == | == Usage Example == | ||
Line 15: | Line 24: | ||
Section Install | Section Install | ||
CreateShortcut "$SMPrograms\MyApp.lnk" "$Instdir\MyApp.exe" | |||
CreateShortcut "$SMPrograms | WinShell::SetLnkAUMI "$SMPrograms\MyApp.lnk" "${MyApp_AppUserModelId}" | ||
WinShell::SetLnkAUMI "$SMPrograms | |||
SectionEnd | SectionEnd | ||
Line 24: | Line 32: | ||
WinShell::UninstAppUserModelId "${MyApp_AppUserModelId}" | WinShell::UninstAppUserModelId "${MyApp_AppUserModelId}" | ||
WinShell::UninstShortcut "$SMPrograms\MyApp\MyApp.lnk" | WinShell::UninstShortcut "$SMPrograms\MyApp.lnk" | ||
Delete "$SMPrograms\MyApp.lnk" | |||
SectionEnd | |||
</highlight-nsis> | |||
== System plug-in alternative == | |||
<highlight-nsis> | |||
!include "Win\COM.nsh" | |||
!include LogicLib.nsh | |||
Section Uninstall | |||
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_DestinationList} ${IID_ICustomDestinationList} r1 "" | |||
${If} $1 P<> 0 | |||
${ICustomDestinationList::DeleteList} $1 '("${MyApp_AppUserModelId}")' | |||
${IUnknown::Release} $1 "" | |||
${EndIf} | |||
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_ApplicationDestinations} ${IID_IApplicationDestinations} r1 "" | |||
${If} $1 P<> 0 | |||
${IApplicationDestinations::SetAppID} $1 '("${MyApp_AppUserModelId}")i.r0' | |||
${If} $0 >= 0 | |||
${IApplicationDestinations::RemoveAllDestinations} $1 '' | |||
${EndIf} | |||
${IUnknown::Release} $1 "" | |||
${EndIf} | |||
!include Integration.nsh | |||
${UnpinShortcut} "$SMPrograms\MyApp.lnk" | |||
Delete "$SMPrograms\MyApp.lnk" | |||
SectionEnd | SectionEnd | ||
</highlight-nsis> | </highlight-nsis> |
Latest revision as of 22:01, 7 June 2021
Author: Anders (talk, contrib) |
Plugin Info
- Version: 20121005
- Type: Runtime plugin
- Character encoding: Ansi & Unicode
- Minimum OS: Win95/NT4
- Minimum NSIS Version: 2.0
- License: Freeware
- Download: WinShell.zip (2 KB)
Information
SetLnkAUMI sets the PKEY_AppUserModel_ID property on a shortcut.
UninstAppUserModelId calls IApplicationDestinations::RemoveAllDestinations and ICustomDestinationList::DeleteList.
UninstShortcut calls IStartMenuPinnedList::RemoveFromList.
Usage Example
!define MyApp_AppUserModelId "MyCompany.MyApp.xyz" Section Install CreateShortcut "$SMPrograms\MyApp.lnk" "$Instdir\MyApp.exe" WinShell::SetLnkAUMI "$SMPrograms\MyApp.lnk" "${MyApp_AppUserModelId}" SectionEnd Section Uninstall WinShell::UninstAppUserModelId "${MyApp_AppUserModelId}" WinShell::UninstShortcut "$SMPrograms\MyApp.lnk" Delete "$SMPrograms\MyApp.lnk" SectionEnd
System plug-in alternative
!include "Win\COM.nsh" !include LogicLib.nsh Section Uninstall !insertmacro ComHlpr_CreateInProcInstance ${CLSID_DestinationList} ${IID_ICustomDestinationList} r1 "" ${If} $1 P<> 0 ${ICustomDestinationList::DeleteList} $1 '("${MyApp_AppUserModelId}")' ${IUnknown::Release} $1 "" ${EndIf} !insertmacro ComHlpr_CreateInProcInstance ${CLSID_ApplicationDestinations} ${IID_IApplicationDestinations} r1 "" ${If} $1 P<> 0 ${IApplicationDestinations::SetAppID} $1 '("${MyApp_AppUserModelId}")i.r0' ${If} $0 >= 0 ${IApplicationDestinations::RemoveAllDestinations} $1 '' ${EndIf} ${IUnknown::Release} $1 "" ${EndIf} !include Integration.nsh ${UnpinShortcut} "$SMPrograms\MyApp.lnk" Delete "$SMPrograms\MyApp.lnk" SectionEnd
Credits
Written by Anders (For fun and profit?)