Added UnpinShortcut and NotifyShell_AssocChanged macros

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7183 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2020-05-21 00:44:39 +00:00
parent ea50284c18
commit 3c47165946
6 changed files with 63 additions and 16 deletions

View file

@ -22,6 +22,7 @@ InstallDirRegKey HKCU "${REGPATH_UNINSTSUBKEY}" "UninstallString"
!include LogicLib.nsh
!include WinCore.nsh
!include Integration.nsh
Page Directory
@ -103,7 +104,7 @@ Section -ShellAssoc
WriteRegStr ShCtx "Software\RegisteredApplications" "Nullsoft Test App" "Software\Classes\Applications\${ASSOC_APPEXE}\Capabilities"
!endif
System::Call 'SHELL32::SHChangeNotify(i0x08000000, i0, p0, p0)' ; Notify the shell with SHCNE_ASSOCCHANGED
${NotifyShell_AssocChanged}
SectionEnd
@ -153,14 +154,15 @@ Section -un.ShellAssoc
;DeleteRegKey HKCU "Software\Microsoft\Windows\Roaming\OpenWith\FileExts\${ASSOC_EXT}"
;DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\${ASSOC_EXT}"
System::Call 'SHELL32::SHChangeNotify(i0x08000000, i0, p0, p0)' ; Notify the shell with SHCNE_ASSOCCHANGED
${NotifyShell_AssocChanged}
SectionEnd
Section -Uninstall
${UnpinShortcut} "$SMPrograms\${NAME}.lnk"
Delete "$SMPrograms\${NAME}.lnk"
Delete "$InstDir\MyApp.exe"
Delete "$InstDir\Uninst.exe"
RMDir "$InstDir"
DeleteRegKey HKCU "${REGPATH_UNINSTSUBKEY}"
Delete "$SMPrograms\${NAME}.lnk"
SectionEnd

View file

@ -21,14 +21,15 @@ RequestExecutionLevel Admin ; Request admin rights on WinVista+ (when UAC is tur
InstallDir "$ProgramFiles\$(^Name)"
InstallDirRegKey HKLM "${REGPATH_UNINSTSUBKEY}" "UninstallString"
!include LogicLib.nsh
!include Integration.nsh
Page Directory
Page InstFiles
Uninstpage UninstConfirm
Uninstpage InstFiles
!include LogicLib.nsh
!macro EnsureAdminRights
UserInfo::GetAccountType
Pop $0
@ -70,10 +71,11 @@ SectionEnd
Section -Uninstall
${UnpinShortcut} "$SMPrograms\${NAME}.lnk"
Delete "$SMPrograms\${NAME}.lnk"
Delete "$InstDir\MyApp.exe"
Delete "$InstDir\Uninst.exe"
RMDir "$InstDir"
DeleteRegKey HKLM "${REGPATH_UNINSTSUBKEY}"
Delete "$SMPrograms\${NAME}.lnk"
SectionEnd

View file

@ -49,12 +49,7 @@ RequestExecutionLevel admin
!include "Memento.nsh"
!include "WordFunc.nsh"
!include "Util.nsh"
;--------------------------------
;Definitions
!define SHCNE_ASSOCCHANGED 0x8000000
!define SHCNF_IDLIST 0
!include "Integration.nsh"
;--------------------------------
;Configuration
@ -213,6 +208,7 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
File ..\Include\MultiUser.nsh
File ..\Include\VB6RunTime.nsh
File ..\Include\Util.nsh
File ..\Include\Integration.nsh
File ..\Include\WinCore.nsh
SetOutPath $INSTDIR\Include\Win
@ -296,7 +292,7 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
WriteRegStr HKCR "NSIS.Header\shell\open\command" "" 'notepad.exe "%1"'
${EndIf}
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p0, p0)'
${NotifyShell_AssocChanged}
${MementoSectionEnd}
@ -1071,7 +1067,7 @@ Section Uninstall
!insertmacro AssocDeleteFileExtAndProgId HKLM ".nsi" "NSIS.Script"
!insertmacro AssocDeleteFileExtAndProgId HKLM ".nsh" "NSIS.Header"
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p0, p0)'
${NotifyShell_AssocChanged}
DeleteRegKey HKLM "${REG_UNINST_KEY}"
DeleteRegKey HKLM "Software\NSIS"