Hello
can you help me? i have searched in the forum and in the documentation but i don't find that i want.
i have a two programs who are need to be install in the same path. i install one of this 2 programs, i want my program read a key
readRegStr $R6 HKCU "Software\${COMPANY}" "PathComp" and if is key is configured i want my program use this path (the path appears in directory page but is not possible to modify) but if key is empty, the user can modify the path in directory page.
thanks for your help.
force install dir when a previous installation is finded
5 posts
Use InstallDirRegKey to initially set $INSTDIR to whatever is in that key. If it's empty, copy your default installation directory into $INSTDIR in .onInit and set a variable to a certain vaule. In the show function of the directory selection page enable or disable the directory selection box according to the value of that variable.
To enable/disable the box use:
To enable/disable the box use:
The EnableWindow instruction is available only in the latest CVS version. If you're using b3 use the System plug-in instead:FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $$0 $0 1019
EnableWindow $0 0 # change the last 0 to 1 if you want to enable
# change the last 0 to 1 to enable
System::Call "user32::EnableWindow(i r0, i 0)"
!define MUI_LICENSEPAGE
page directory mapage
!define MUI_STARTMENUPAGE
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE
page directory mapage
!define MUI_STARTMENUPAGE
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE
is it good to put this in script?
i try to use oninit function to initiliaze installdir but i have error
function .oninit
ReadRegStr $R8 HKCU "Software\${COMPANY}" "PathComp"
StrCmp $R8 "" 0 notfirst
InstallDir "$PROGRAMFILES\${COMPANY}\"
InstallDirRegKey HKCU "Software\${COMPANY}\" "PathComp"
goto done
notfirst:
InstallDir $R8
InstallDirRegKey HKCU "Software\${COMPANY}\" "PathComp"
goto done
done:
Functionend
i don't kow what i put in function mapage
!define MUI_LICENSEPAGE
page directory mapage
!define MUI_STARTMENUPAGE
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE
function mapage
System::Call "user32::EnableWindow(i r0, i 0)"
functionend
i try to use oninit function to initiliaze installdir but i have error
function .oninit
ReadRegStr $R8 HKCU "Software\${COMPANY}" "PathComp"
StrCmp $R8 "" 0 notfirst
InstallDir "$PROGRAMFILES\${COMPANY}\"
InstallDirRegKey HKCU "Software\${COMPANY}\" "PathComp"
goto done
notfirst:
InstallDir $R8
InstallDirRegKey HKCU "Software\${COMPANY}\" "PathComp"
goto done
done:
Functionend
i don't kow what i put in function mapage
!define MUI_LICENSEPAGE
page directory mapage
!define MUI_STARTMENUPAGE
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE
function mapage
System::Call "user32::EnableWindow(i r0, i 0)"
functionend
InstallDir and InstallDirRegKey can't be used inside functions or section. Use StrCpy $INSTDIR "something" to set $INSTDIR manually.
As for the disabling of the text box, that's not the way to do it. You should put the code in the show function, not the pre function. That's also not the way to define a show function using the MUI. See the MUI readme for more information about page's callbacks functions. You have also copied just part of the disbaling script. That System line is a replacement just for the EnableWindow command, not all of the code.
As for the disabling of the text box, that's not the way to do it. You should put the code in the show function, not the pre function. That's also not the way to define a show function using the MUI. See the MUI readme for more information about page's callbacks functions. You have also copied just part of the disbaling script. That System line is a replacement just for the EnableWindow command, not all of the code.