Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 27th June 2008, 08:03   #1
k_hejwosz
Junior Member
 
Join Date: Sep 2003
Posts: 27
.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
k_hejwosz is offline   Reply With Quote
Old 27th June 2008, 08:28   #2
TobbeSweden
Senior Member
 
Join Date: Oct 2006
Posts: 106
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>
TobbeSweden is offline   Reply With Quote
Old 27th June 2008, 09:45   #3
k_hejwosz
Junior Member
 
Join Date: Sep 2003
Posts: 27
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
k_hejwosz is offline   Reply With Quote
Old 27th June 2008, 10:16   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,814
1019

IntOp $PostCount $PostCount + 1
Anders is online now   Reply With Quote
Old 27th June 2008, 12:04   #5
k_hejwosz
Junior Member
 
Join Date: Sep 2003
Posts: 27
Thx a bunch TobbeSweden and Anders.

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

Regards,
Michael
k_hejwosz is offline   Reply With Quote
Old 27th June 2008, 12:17   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,814
use resource hacker on the .exe, or at runtime with http://www.catch22.net/software/winspy.asp

IntOp $PostCount $PostCount + 1
Anders is online now   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump