diff --git a/Contrib/InstallOptions/InstallerOptions.cpp b/Contrib/InstallOptions/InstallerOptions.cpp index d9291c9a..7669cd00 100644 --- a/Contrib/InstallOptions/InstallerOptions.cpp +++ b/Contrib/InstallOptions/InstallerOptions.cpp @@ -644,7 +644,11 @@ LRESULT WINAPI WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify) if (pField->nFlags & FLAG_NOTIFY) { // Remember which control was activated then pretend the user clicked Next g_NotifyField = nIdx + 1; + // the next button must be enabled or nsis will ignore WM_COMMAND + BOOL bWasDisabled = EnableWindow(hNextButton, TRUE); FORWARD_WM_COMMAND(hMainWindow, IDOK, hNextButton, codeNotify, mySendMessage); + if (bWasDisabled) + EnableWindow(hNextButton, FALSE); } } break; diff --git a/Contrib/NSISdl/nsisdl.cpp b/Contrib/NSISdl/nsisdl.cpp index 0bc67e89..f7ffb036 100644 --- a/Contrib/NSISdl/nsisdl.cpp +++ b/Contrib/NSISdl/nsisdl.cpp @@ -233,8 +233,6 @@ __declspec(dllexport) void download (HWND parent, if (IsWindowVisible(hwndB)) ShowWindow(hwndB,SW_HIDE); else hwndB=NULL; - wasen=EnableWindow(GetDlgItem(parent,IDCANCEL),1); - lpWndProcOld = (void *)SetWindowLong(parent,GWL_WNDPROC,(long)ParentWndProc); dlg = CreateDialog((HINSTANCE)hModule, @@ -307,6 +305,13 @@ __declspec(dllexport) void download (HWND parent, SendDlgItemMessage(dlg, pbid, WM_SETFONT, hFont, 0); SendDlgItemMessage(dlg, IDC_STATIC2, WM_SETFONT, hFont, 0); } + + // enable the cancel button + wasen=EnableWindow(GetDlgItem(parent,IDCANCEL),TRUE); + SendMessage(parent, DM_SETDEFID, IDCANCEL, 0); + // remove the BS_DEFPUSHBUTTON style from IDOK + SendMessage(GetDlgItem(parent, IDOK), BM_SETSTYLE, BS_PUSHBUTTON, TRUE); + SetFocus(GetDlgItem(parent,IDCANCEL)); } { WSADATA wsaData; @@ -385,7 +390,7 @@ __declspec(dllexport) void download (HWND parent, SetWindowPos(childwnd,0,0,0,orig_childRc.right-orig_childRc.left,orig_childRc.bottom-orig_childRc.top,SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOMOVE); - if (wasen) EnableWindow(GetDlgItem(parent,IDCANCEL),0); + if (wasen) EnableWindow(GetDlgItem(parent,IDCANCEL),FALSE); } if ( !error ) error = "cancel"; diff --git a/Plugins/InstallOptions.dll b/Plugins/InstallOptions.dll index 93dcc54a..c139277f 100644 Binary files a/Plugins/InstallOptions.dll and b/Plugins/InstallOptions.dll differ diff --git a/Plugins/nsisdl.dll b/Plugins/nsisdl.dll index 1fe949e6..bbd0b7b5 100644 Binary files a/Plugins/nsisdl.dll and b/Plugins/nsisdl.dll differ diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 13896f57..e9c02668 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -96,43 +96,39 @@ static BOOL NSISCALL SetDlgItemTextFromLang_(HWND dlg, int id, int lid) { #ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT #define HandleStaticBkColor() _HandleStaticBkColor(uMsg, wParam, lParam) -static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) { - case WM_CTLCOLORSTATIC: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORDLG: - case WM_CTLCOLORBTN: - { - ctlcolors *c = (ctlcolors *)GetWindowLong((HWND)lParam, GWL_USERDATA); +static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if ((uMsg - WM_CTLCOLOREDIT) <= (WM_CTLCOLORSTATIC - WM_CTLCOLOREDIT)) + { + ctlcolors *c = (ctlcolors *)GetWindowLong((HWND)lParam, GWL_USERDATA); - if (c) { - COLORREF text; - LOGBRUSH lh; + if (c) { + COLORREF text; + LOGBRUSH lh; - text = c->text; - if (c->flags & CC_TEXT_SYS) - text = GetSysColor(text); - if (c->flags & CC_TEXT) - SetTextColor((HDC)wParam, text); + text = c->text; + if (c->flags & CC_TEXT_SYS) + text = GetSysColor(text); + if (c->flags & CC_TEXT) + SetTextColor((HDC)wParam, text); - SetBkMode((HDC)wParam, c->bkmode); + SetBkMode((HDC)wParam, c->bkmode); - lh.lbColor = c->bkc; - if (c->flags & CC_BK_SYS) - lh.lbColor = GetSysColor(lh.lbColor); - if (c->flags & CC_BK) - SetBkColor((HDC)wParam, lh.lbColor); + lh.lbColor = c->bkc; + if (c->flags & CC_BK_SYS) + lh.lbColor = GetSysColor(lh.lbColor); + if (c->flags & CC_BK) + SetBkColor((HDC)wParam, lh.lbColor); - if (c->flags & CC_BKB) - { - lh.lbStyle = c->lbStyle; - if (c->bkb) - DeleteObject(c->bkb); - c->bkb = CreateBrushIndirect(&lh); - } - - return (BOOL)c->bkb; + if (c->flags & CC_BKB) + { + lh.lbStyle = c->lbStyle; + if (c->bkb) + DeleteObject(c->bkb); + c->bkb = CreateBrushIndirect(&lh); } + + return (BOOL)c->bkb; } } return 0; @@ -553,7 +549,7 @@ skipPage: } if (uMsg == WM_CLOSE && m_page == g_blocks[NB_PAGES].num - 1) { - if (!IsWindowEnabled(m_hwndCancel) && IsWindowEnabled(m_hwndOK)) + if (!IsWindowEnabled(m_hwndCancel)) { uMsg = WM_COMMAND; wParam = IDOK; @@ -561,7 +557,10 @@ skipPage: } if (uMsg == WM_COMMAND) { - int id=LOWORD(wParam); + int id = LOWORD(wParam); + HWND hCtl = GetDlgItem(hwndDlg, id); + if (hCtl && !IsWindowEnabled(hCtl)) + return 0; if (id == IDOK) { @@ -596,7 +595,7 @@ skipPage: { // Forward WM_COMMANDs to inner dialogs, can be custom ones. // Without this, enter on buttons in inner dialogs won't work. - SendMessage(m_curwnd, uMsg, wParam, lParam); + SendMessage(m_curwnd, WM_COMMAND, wParam, lParam); } } return HandleStaticBkColor(); @@ -700,8 +699,8 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM { if (msgfilter->msg==WM_KEYDOWN) { - if (msgfilter->wParam==VK_RETURN && IsWindowEnabled(m_hwndOK)) { - outernotify(1); + if (msgfilter->wParam==VK_RETURN) { + SendMessage(g_hwnd, WM_COMMAND, IDOK, 0); } if (msgfilter->wParam==VK_ESCAPE) { SendMessage(g_hwnd, WM_CLOSE, 0, 0);