diff --git a/Contrib/StartMenu/Readme.txt b/Contrib/StartMenu/Readme.txt index 0103d904..74f39fa2 100644 --- a/Contrib/StartMenu/Readme.txt +++ b/Contrib/StartMenu/Readme.txt @@ -29,6 +29,19 @@ prefixed with '>'. The function does not push the full path but only the selecte 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. +To set properties of the controls on the page, such as colors and fonts use Init +and Show instead of Select. Init will push the HWND of the page on the stack, +or an error string. For example: + +StartMenu::Init /NOUNLOAD "Test" +Pop $0 +IntCmp $0 0 failed +GetDlgItem $0 $0 1003 +SetCtlColors $0 "" FF0000 +StartMenu::Show +# continue as with Select here +failed: + +Look at Example.nsi for a full example (without Init and Select). Created by Amir Szekely (aka KiCHiK) \ No newline at end of file diff --git a/Contrib/StartMenu/StartMenu.c b/Contrib/StartMenu/StartMenu.c index 5c5262d9..9c9d37ce 100644 --- a/Contrib/StartMenu/StartMenu.c +++ b/Contrib/StartMenu/StartMenu.c @@ -27,7 +27,7 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); BOOL CALLBACK ParentWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); void AddFolderFromReg(int nFolder); -void __declspec(dllexport) Select(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) +void __declspec(dllexport) Init(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) { HWND hwStartMenuSelect; @@ -71,11 +71,17 @@ void __declspec(dllexport) Select(HWND hwndParent, int string_size, char *variab { popstring(checkbox); } + if (popstring(buf)) + { *buf = 0; + } } + if (*buf) + { lstrcpy(progname, buf); + } else { pushstring("error reading parameters"); @@ -87,23 +93,40 @@ void __declspec(dllexport) Select(HWND hwndParent, int string_size, char *variab if (!hwStartMenuSelect) { pushstring("error creating dialog"); - g_done = 1; + return; } else { lpWndProcOld = (void *) SetWindowLong(hwndParent, DWL_DLGPROC, (long) ParentWndProc); + wsprintf(buf, "%u", hwStartMenuSelect); + pushstring(buf); } + } +} - while (!g_done) - { - MSG msg; - int nResult = GetMessage(&msg, NULL, 0, 0); - if (!IsDialogMessage(hwStartMenuSelect,&msg) && !IsDialogMessage(hwndParent,&msg) && !TranslateMessage(&msg)) - DispatchMessage(&msg); - } - DestroyWindow(hwStartMenuSelect); +void __declspec(dllexport) Show(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) +{ + HWND hwStartMenuSelect = g_hwStartMenuSelect; - SetWindowLong(hwndParent, DWL_DLGPROC, (long) lpWndProcOld); + while (!g_done) + { + MSG msg; + int nResult = GetMessage(&msg, NULL, 0, 0); + if (!IsDialogMessage(hwStartMenuSelect,&msg) && !IsDialogMessage(hwndParent,&msg) && !TranslateMessage(&msg)) + DispatchMessage(&msg); + } + DestroyWindow(hwStartMenuSelect); + + SetWindowLong(hwndParent, DWL_DLGPROC, (long) lpWndProcOld); +} + +void __declspec(dllexport) Select(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) +{ + Init(hwndParent, string_size, variables, stacktop); + if (g_hwStartMenuSelect) + { + popstring(buf); + Show(hwndParent, string_size, variables, stacktop); } } @@ -345,6 +368,13 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) pushstring(buf); pushstring("success"); } + case WM_CTLCOLORSTATIC: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORDLG: + case WM_CTLCOLORBTN: + case WM_CTLCOLORLISTBOX: + // let the NSIS window handle colors, it knows best + return SendMessage(hwParent, uMsg, wParam, lParam); break; } return 0; diff --git a/Plugins/StartMenu.dll b/Plugins/StartMenu.dll index 0ea07a91..b193ac85 100644 Binary files a/Plugins/StartMenu.dll and b/Plugins/StartMenu.dll differ