diff --git a/Contrib/Modern UI/System.nsh b/Contrib/Modern UI/System.nsh index d5910bc6..76073e5a 100644 --- a/Contrib/Modern UI/System.nsh +++ b/Contrib/Modern UI/System.nsh @@ -1088,6 +1088,8 @@ !endif Function "${SETSTARTMENU}" + + Push ${MUI_TEMP1} !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_STARTMENU_TITLE) $(MUI_TEXT_STARTMENU_SUBTITLE) @@ -1095,21 +1097,23 @@ !ifdef MUI_STARTMENU_REGISTRY_KEY !ifdef MUI_STARTMENU_REGISTRY_VALUENAME - StrCmp "${MUI_STARTMENU_VARIABLE}" "" "" +6 - - Push ${MUI_TEMP1} + StrCmp "${MUI_STARTMENU_VARIABLE}" "" "" +4 + ReadRegStr ${MUI_TEMP1} "${MUI_STARTMENU_REGISTRY_ROOT}" "${MUI_STARTMENU_REGISTRY_KEY}" "${MUI_STARTMENU_REGISTRY_VALUENAME}" StrCmp ${MUI_TEMP1} "" +2 StrCpy "${MUI_STARTMENU_VARIABLE}" ${MUI_TEMP1} - Pop ${MUI_TEMP1} - + !endif !endif !endif StartMenu::Select /noicon /autoadd /text "$(MUI_INNERTEXT_STARTMENU_TOP)" /lastused "${MUI_STARTMENU_VARIABLE}" /checknoshortcuts "$(MUI_INNERTEXT_STARTMENU_CHECKBOX)" "${MUI_STARTMENU_DEFAULTFOLDER}" - Pop "${MUI_STARTMENU_VARIABLE}" - + Pop ${MUI_TEMP1} + StrCmp ${MUI_TEMP1} "success" 0 +2 + Pop "${MUI_STARTMENU_VARIABLE}" + + Pop ${MUI_TEMP1} + FunctionEnd !ifndef MUI_NOVERBOSE diff --git a/Contrib/StartMenu/Example.nsi b/Contrib/StartMenu/Example.nsi index 12594bf1..b9b65dd9 100644 --- a/Contrib/StartMenu/Example.nsi +++ b/Contrib/StartMenu/Example.nsi @@ -15,16 +15,21 @@ FunctionEnd Page custom StartMenuGroupSelect ": Start Menu Folder" Function StartMenuGroupSelect + Push $R1 + StartMenu::Select /checknoshortcuts "Don't create a start menu folder" /autoadd /lastused $R0 "StartMenu.dll test" Pop $R1 - StrCpy $R2 $R1 5 - StrCmp $R2 "error" 0 +3 + StrCmp $R1 "success" success + StrCmp $R1 "cancel" done ; error MessageBox MB_OK $R1 Return - StrCpy $R0 $R1 ; got the dir, or cancel, but if it's cancel NSIS will exit and - ; then we shouldn't care about the value of $R0 + success: + Pop $R0 + + done: + Pop $R1 FunctionEnd Page instfiles diff --git a/Contrib/StartMenu/Readme.txt b/Contrib/StartMenu/Readme.txt index 2fbe11a6..af1cd51e 100644 --- a/Contrib/StartMenu/Readme.txt +++ b/Contrib/StartMenu/Readme.txt @@ -15,9 +15,12 @@ which is the program group default name, and some more optional parameters: will have > as its first character and you should not create the program group. -The function pushes the folder selection back to the stack. It does not push the -full path but only the selected sub-folder. It's up to you to decide if to put -it in the current user or all users start menu. +The function pushes "success", "cancel" or an error to the stack. If there was no +error and the user didn't press on cancel it will push the selected folder name +after "success". If the user checked the no shortcuts checkbox the '>' will be +appended to the folder name. The function does not push the full path but only the +selected sub-folder. It's up to you to decide if to put it in the current user or +all users start menu. Look at Example.nsi for an example. diff --git a/Contrib/StartMenu/StartMenu.c b/Contrib/StartMenu/StartMenu.c index 07f4c21c..ca73b2e5 100644 --- a/Contrib/StartMenu/StartMenu.c +++ b/Contrib/StartMenu/StartMenu.c @@ -285,6 +285,7 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) else *buf = 0; GetWindowText(hwLocation, buf + (*buf ? 1 : 0), MAX_PATH); pushstring(buf); + pushstring("success"); } break; } diff --git a/Plugins/StartMenu.dll b/Plugins/StartMenu.dll index ec7d9a90..f16bdb31 100644 Binary files a/Plugins/StartMenu.dll and b/Plugins/StartMenu.dll differ