Archive: .onVerify InstDir


.onVerify InstDir
I am using this hook to inform the user that if s/he chooses to include Program Files folder in the path of the installation folder, s/he will need to Run as Administrator to run our program in Vista.

I am using MessageBox MB_YESNO|MB_ICONEXCLAMATION ... and give him/her an option to revert to the default installation directory if s/he presses YES. However, it does not get displayed in the Install to... text box. I use StrCpy $INSTDIR C:\SuperMemo

How can I update the text box with the default installation dir??

Regards,
Michael


Something like this:
GetDlgItem $R0 $HWNDPARENT <number>
SendMessage $R0 ${WM_SETTEXT} 0 "STR:My Text"

But with the right hWnd

EDIT:
Try with
GetDlgItem $R0 $hwnd 1206 ; PathRequest control (1200 + field 7 - 1)
instead of GetDlgItem $R0 $HWNDPARENT <number>


Having exhausted all my ideas, I still cannot make it work:

This is the function I use:

Function isProgramFilesinVista
!insertmacro StrStr $IsProgramFilesFld $INSTDIR $PROGRAMFILES
StrLen $IsProgramFilesFld $IsProgramFilesFld

StrCmp "$IsProgramFilesFld" "0" END 0
${Unless} $iWinVerMaj U< 6
FindWindow $hWnd "#32770" "" $HWNDPARENT
MessageBox MB_YESNO|MB_ICONEXCLAMATION "It is recommended that you do not change the default installation folder to \Program Files\. Otherwise you will need to Run as Administrator to use SuperMemo $sSMYear4D.${sNLn}${sNLn}Do you want to revert to the default C:\SUPERMEMO installation folder?" IDNO END IDYES 0
StrCpy $INSTDIR "C:\SuperMemo"
GetDlgItem $R0 $hWnd 1206
MessageBox MB_OK $R0
SendMessage $R0 ${WM_SETTEXT} 0 "STR:$INSTDIR"
Abort
${EndUnless}

END:
FunctionEnd


It is hooked like this:

!define MUI_PAGE_CUSTOMFUNCTION_LEAVE isProgramFilesinVista
!insertmacro MUI_PAGE_DIRECTORY

Whatever 120x number I type in, GetDlgItem always return 0.

Regards,
Michael


1019


Thx a bunch TobbeSweden and Anders.

Anders, is there a way I could find it out by myself??

Regards,
Michael


use resource hacker on the .exe, or at runtime with http://www.catch22.net/software/winspy.asp