tags:

views:

111

answers:

2

Hello!

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 setup 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

+2  A: 

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
Anders
A: 

Hello!

Thank you for your reply! That was exactly what I needed. Thank you very much! Buba

Buba235
I see that you are new here, you should mark it as the answer if my solution worked for you.
Anders
@Buba : You should remove this answer as it's not an answer AND you should accept Anders' answer. Thank you.
Silence