Archive: Start Menu variable not set in MUI Start Menu Leave ?


Start Menu variable not set in MUI Start Menu Leave ?
  In NSIS 2.19

I think that the MUI custom leave function for the Start Menu is not setting the variable specified. It does get set when the MUI Start Menu page is completely gone (after the custom leave function), but not in the function.

eg. (subset of full installer)

!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveFunction_StartMenuSelect
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Default"
!insertmacro MUI_PAGE_STARTMENU "MainApp" $StartMenuLocation

Function LeaveFunction_StartMenuSelect

MessageBox MB_OK $StartMenuLocation

FunctionEnd

And $StartMenuLocation keeps coming up blank/null/""

I found a similar report from 2003 - http://forums.winamp.com/showthread.php?threadid=140253 and I am wondering if this is an issue that hasn't been fixed yet or not properly reported. Anyone else seeing this?


The StartMenu only pushes the result when its finished. There's no INI to update as with InstallOptions. You could get the text on your own calling GetWindowText using the System plug-in.


While I understand what you are saying and I am going to try the GetWindowText in a few minutes, this still seems like a bug to me.

This kind of functionality exists in Dir Select page and I am able to fully and completly filter and edit all possible bad characters through the _LEAVE function.

When I needed to filter bad characters in the Start Menu page, this page does not set the variable like it does in the Dir Select page. This functionality was expected because it works perfectly in Dir Select. Without it, I am unable to filter bad characters, although I should be able to now, using your GetWindowText suggestion.

Would you reconsider this issue as a bug, or is it dead?


Tryint to get this to work, but I guess I don't know how to get the control ID for the MUI Start Menu edit box correctly

FindWindow$0 "#32770" "" $HWNDPARENT

GetDlgItem$1 $0 1000
>
I have tried 1000 and 1019 but no luck, or am I just totally off in the weeds?

OK, I have it all mostly working now. Here is what is going right:


FindWindow $3 "#32770" "" $HWNDPARENT

GetDlgItem$2 $3 1002 ; 1002 is the ID of the Start Menu Edit
System
::Call 'User32::GetWindowText(i $2, t .R0, i 256)'
And $R0 ends up with the Start Menu that has been selected/typed in. I do my validation code after this, and once its all done, I re-write the edit box with:
System::Call 'User32::SetWindowText(i $2, t "$R0")' 
and call the abort if I want the user to fix the Start Menu path.

Originally posted by CrushBug
Would you reconsider this issue as a bug, or is it dead?
You could submit a bug report/feature request/patch. It would be best if the leave function would have the correct value, but as you can understand from my earlier explanation, there's a technical difficulty involved. A possible solution would be having the MUI use GetWindowsText on its own before calling your leave function.