开发者

NSIS already installed product

I have some problem with my created nsis setup. I need to check if the product is already installed and then get the path to the already installed product. This is because I want to build a "Feature-Setup" that installs some other components into the previous installed folder. Does anyone know how to build this installer? It will be brilliant if the feature s开发者_如何学Pythonetup will start the installation and check the path of the installed product. After checking is done the path should be (read only) in "Destination Folder" under "Choose Install Location".

Thanks for any help

Buba


NSIS does not write anything anywhere on its own, so unless you added a entry to <HKLM/HKCU>\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall or Software\Yourcompany\Yourapp on your own, you pretty much have to search the machine with FindFirst,FindNext. (Ugly)

If you have a registry entry, you can use InstallDirRegKey or the normal registry functions:

!define MyRegKey "Software\MyCompany\MyApp"

InstallDirRegKey HKLM "${MyRegKey}" InstallDir

var LockDirPage

!include LogicLib.nsh
Function .onInit
${If} ${FileExists} "$instdir\MyApp.exe"
    StrCpy $LockDirPage 1
${EndIf}
FunctionEnd

Function dirshow
${If} $LockDirPage = 1
    FindWindow $0 "#32770" "" $HWNDPARENT
    GetDlgItem $1 $0 0x3FB
    EnableWindow $1 0
    GetDlgItem $1 $0 0x3E9
    EnableWindow $1 0
${EndIf}
FunctionEnd

page directory "" dirshow
page instfiles

Section
WriteRegStr HKLM "${MyRegKey}" InstallDir $instdir ;save location
SectionEnd
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜