k_hejwosz
27th June 2008 09:03 UTC
.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
TobbeSweden
27th June 2008 09:28 UTC
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>
k_hejwosz
27th June 2008 10:45 UTC
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
Anders
27th June 2008 11:16 UTC
1019
k_hejwosz
27th June 2008 13:04 UTC
Thx a bunch TobbeSweden and Anders.
Anders, is there a way I could find it out by myself??
Regards,
Michael
Anders
27th June 2008 13:17 UTC
use resource hacker on the .exe, or at runtime with http://www.catch22.net/software/winspy.asp