mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:42:57 +00:00
Added some more features for messageboxes (MB_HELP, MB_RIGHT,
MB_CANCELTRYCONTINUE, MB_TOPMOST) and made some other changes. Patch by Thomas Weidenmueller. svn path=/trunk/; revision=5305
This commit is contained in:
parent
c96f5dedff
commit
c08e57bdfe
2 changed files with 271 additions and 125 deletions
|
@ -44,7 +44,7 @@ OBM_CLOSE BITMAP "resources/obm_close.bmp"
|
||||||
// Dialog
|
// Dialog
|
||||||
//
|
//
|
||||||
|
|
||||||
MSGBOX DIALOG DISCARDABLE 100, 80, 375, 168
|
MSGBOX DIALOG DISCARDABLE 100, 80, 495, 77
|
||||||
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||||
WS_SYSMENU
|
WS_SYSMENU
|
||||||
FONT 8, "MS Sans Serif"
|
FONT 8, "MS Sans Serif"
|
||||||
|
@ -56,8 +56,11 @@ BEGIN
|
||||||
PUSHBUTTON "&Abort", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
PUSHBUTTON "&Abort", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
PUSHBUTTON "&Retry", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
PUSHBUTTON "&Retry", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
PUSHBUTTON "&Ignore", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
PUSHBUTTON "&Ignore", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
PUSHBUTTON "&Yes", 6, 206, 26, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
PUSHBUTTON "&Yes", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
PUSHBUTTON "&No", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
PUSHBUTTON "&No", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
PUSHBUTTON "&Help", 9, 351, 55, 40, 14, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
PUSHBUTTON "&Try Again", 10, 398, 54, 40, 14, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
|
PUSHBUTTON "&Continue", 11, 445, 55, 40, 14, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: messagebox.c,v 1.8 2003/07/28 08:09:51 ekohl Exp $
|
/* $Id: messagebox.c,v 1.9 2003/07/28 23:23:17 ekohl Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/messagebox.c
|
* FILE: lib/user32/windows/messagebox.c
|
||||||
|
@ -24,7 +24,8 @@
|
||||||
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||||
* Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
* Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 07-27-2003 Code ported from wine
|
* 2003/07/28 Added some NT features
|
||||||
|
* 2003/07/27 Code ported from wine
|
||||||
* 09-05-2001 CSH Created
|
* 09-05-2001 CSH Created
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -48,14 +49,14 @@
|
||||||
|
|
||||||
#define RT_DIALOGA MAKEINTRESOURCEA(5)
|
#define RT_DIALOGA MAKEINTRESOURCEA(5)
|
||||||
#define RT_DIALOGW MAKEINTRESOURCEW(5)
|
#define RT_DIALOGW MAKEINTRESOURCEW(5)
|
||||||
#define IDI_HANDA MAKEINTRESOURCEA(32513)
|
#define IDI_HANDA MAKEINTRESOURCEA(32513)
|
||||||
#define IDI_HANDW MAKEINTRESOURCEW(32513)
|
#define IDI_HANDW MAKEINTRESOURCEW(32513)
|
||||||
#define IDI_QUESTIONA MAKEINTRESOURCEA(32514)
|
#define IDI_QUESTIONA MAKEINTRESOURCEA(32514)
|
||||||
#define IDI_QUESTIONW MAKEINTRESOURCEW(32514)
|
#define IDI_QUESTIONW MAKEINTRESOURCEW(32514)
|
||||||
#define IDI_EXCLAMATIONA MAKEINTRESOURCEA(32515)
|
#define IDI_EXCLAMATIONA MAKEINTRESOURCEA(32515)
|
||||||
#define IDI_EXCLAMATIONW MAKEINTRESOURCEW(32515)
|
#define IDI_EXCLAMATIONW MAKEINTRESOURCEW(32515)
|
||||||
#define IDI_ASTERISKA MAKEINTRESOURCEA(32516)
|
#define IDI_ASTERISKA MAKEINTRESOURCEA(32516)
|
||||||
#define IDI_ASTERISKW MAKEINTRESOURCEW(32516)
|
#define IDI_ASTERISKW MAKEINTRESOURCEW(32516)
|
||||||
#define IDI_WINLOGOA MAKEINTRESOURCEA(32517)
|
#define IDI_WINLOGOA MAKEINTRESOURCEA(32517)
|
||||||
#define IDI_WINLOGOW MAKEINTRESOURCEW(32517)
|
#define IDI_WINLOGOW MAKEINTRESOURCEW(32517)
|
||||||
|
|
||||||
|
@ -68,6 +69,15 @@
|
||||||
#ifndef MB_DEFMASK
|
#ifndef MB_DEFMASK
|
||||||
#define MB_DEFMASK 0x00000F00
|
#define MB_DEFMASK 0x00000F00
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef MB_CANCELTRYCONTINUE
|
||||||
|
#define MB_CANCELTRYCONTINUE (0x6L)
|
||||||
|
#endif
|
||||||
|
#ifndef IDTRYAGAIN
|
||||||
|
#define IDTRYAGAIN 10
|
||||||
|
#endif
|
||||||
|
#ifndef IDCONTINUE
|
||||||
|
#define IDCONTINUE 11
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
@ -81,6 +91,7 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb)
|
||||||
int i, buttons;
|
int i, buttons;
|
||||||
int bspace, bw, bh, theight, tleft, wwidth, wheight, bpos;
|
int bspace, bw, bh, theight, tleft, wwidth, wheight, bpos;
|
||||||
int borheight, borwidth, iheight, ileft, iwidth, twidth, tiheight;
|
int borheight, borwidth, iheight, ileft, iwidth, twidth, tiheight;
|
||||||
|
BOOL sdefbtn = FALSE;
|
||||||
LPCWSTR lpszText;
|
LPCWSTR lpszText;
|
||||||
WCHAR buf[256];
|
WCHAR buf[256];
|
||||||
NONCLIENTMETRICSW nclm;
|
NONCLIENTMETRICSW nclm;
|
||||||
|
@ -89,7 +100,7 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb)
|
||||||
SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
|
SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
|
||||||
hFont = CreateFontIndirectW (&nclm.lfMessageFont);
|
hFont = CreateFontIndirectW (&nclm.lfMessageFont);
|
||||||
/* set button font */
|
/* set button font */
|
||||||
for (i=1; i < 8; i++)
|
for (i = 1; i < 10; i++)
|
||||||
SendDlgItemMessageW (hwnd, i, WM_SETFONT, (WPARAM)hFont, 0);
|
SendDlgItemMessageW (hwnd, i, WM_SETFONT, (WPARAM)hFont, 0);
|
||||||
/* set text font */
|
/* set text font */
|
||||||
SendDlgItemMessageW (hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)hFont, 0);
|
SendDlgItemMessageW (hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)hFont, 0);
|
||||||
|
@ -125,67 +136,95 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb)
|
||||||
SetWindowTextW(GetDlgItem(hwnd, MSGBOX_IDTEXT), lpszText);
|
SetWindowTextW(GetDlgItem(hwnd, MSGBOX_IDTEXT), lpszText);
|
||||||
|
|
||||||
/* Hide not selected buttons */
|
/* Hide not selected buttons */
|
||||||
switch(lpmb->dwStyle & MB_TYPEMASK) {
|
switch(lpmb->dwStyle & MB_TYPEMASK)
|
||||||
case MB_OK:
|
{
|
||||||
ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
|
case MB_OK:
|
||||||
/* fall through */
|
ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
|
||||||
case MB_OKCANCEL:
|
/* fall through */
|
||||||
ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
|
case MB_OKCANCEL:
|
||||||
ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
|
||||||
break;
|
ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
|
||||||
case MB_ABORTRETRYIGNORE:
|
ShowWindow(GetDlgItem(hwnd, IDTRYAGAIN), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDCONTINUE), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
|
break;
|
||||||
ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
|
case MB_CANCELTRYCONTINUE:
|
||||||
ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
|
||||||
break;
|
ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
|
||||||
case MB_YESNO:
|
ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
|
||||||
/* fall through */
|
ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE);
|
||||||
case MB_YESNOCANCEL:
|
ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
|
break;
|
||||||
ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
|
case MB_ABORTRETRYIGNORE:
|
||||||
ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
|
||||||
break;
|
ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
|
||||||
case MB_RETRYCANCEL:
|
ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDTRYAGAIN), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDCONTINUE), SW_HIDE);
|
||||||
ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
|
break;
|
||||||
ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
|
case MB_YESNO:
|
||||||
ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
|
ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
|
||||||
break;
|
/* fall through */
|
||||||
|
case MB_YESNOCANCEL:
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDTRYAGAIN), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDCONTINUE), SW_HIDE);
|
||||||
|
break;
|
||||||
|
case MB_RETRYCANCEL:
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDTRYAGAIN), SW_HIDE);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDCONTINUE), SW_HIDE);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
/* Set the icon */
|
/* Hide Help button */
|
||||||
switch(lpmb->dwStyle & MB_ICONMASK) {
|
if(!(lpmb->dwStyle & MB_HELP))
|
||||||
case MB_ICONEXCLAMATION:
|
ShowWindow(GetDlgItem(hwnd, IDHELP), SW_HIDE);
|
||||||
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
|
||||||
(WPARAM)LoadIconW(0, IDI_EXCLAMATIONW), 0);
|
/* Set the icon */
|
||||||
break;
|
switch(lpmb->dwStyle & MB_ICONMASK)
|
||||||
case MB_ICONQUESTION:
|
{
|
||||||
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
case MB_ICONEXCLAMATION:
|
||||||
(WPARAM)LoadIconW(0, IDI_QUESTIONW), 0);
|
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
||||||
break;
|
(WPARAM)LoadIconW(0, IDI_EXCLAMATIONW), 0);
|
||||||
case MB_ICONASTERISK:
|
MessageBeep(MB_ICONEXCLAMATION);
|
||||||
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
break;
|
||||||
(WPARAM)LoadIconW(0, IDI_ASTERISKW), 0);
|
case MB_ICONQUESTION:
|
||||||
break;
|
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
||||||
case MB_ICONHAND:
|
(WPARAM)LoadIconW(0, IDI_QUESTIONW), 0);
|
||||||
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
MessageBeep(MB_ICONQUESTION);
|
||||||
(WPARAM)LoadIconW(0, IDI_HANDW), 0);
|
break;
|
||||||
break;
|
case MB_ICONASTERISK:
|
||||||
case MB_USERICON:
|
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
||||||
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
(WPARAM)LoadIconW(0, IDI_ASTERISKW), 0);
|
||||||
(WPARAM)LoadIconW(lpmb->hInstance, (LPCWSTR)lpmb->lpszIcon), 0);
|
MessageBeep(MB_ICONASTERISK);
|
||||||
break;
|
break;
|
||||||
default:
|
case MB_ICONHAND:
|
||||||
/* By default, Windows 95/98/NT do not associate an icon to message boxes.
|
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
||||||
* So wine should do the same.
|
(WPARAM)LoadIconW(0, IDI_HANDW), 0);
|
||||||
*/
|
MessageBeep(MB_ICONHAND);
|
||||||
break;
|
break;
|
||||||
|
case MB_USERICON:
|
||||||
|
SendDlgItemMessageW(hwnd, 0x0440, STM_SETICON,
|
||||||
|
(WPARAM)LoadIconW(lpmb->hInstance, (LPCWSTR)lpmb->lpszIcon), 0);
|
||||||
|
MessageBeep(MB_OK);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* By default, Windows 95/98/NT does not associate an icon to message boxes.
|
||||||
|
* So ReactOS should do the same.
|
||||||
|
*/
|
||||||
|
MessageBeep(MB_OK);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Position everything */
|
/* Position everything */
|
||||||
|
@ -214,8 +253,10 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb)
|
||||||
|
|
||||||
/* Get the number of visible buttons and their size */
|
/* Get the number of visible buttons and their size */
|
||||||
bh = bw = 1; /* Minimum button sizes */
|
bh = bw = 1; /* Minimum button sizes */
|
||||||
for (buttons = 0, i = 1; i < 8; i++)
|
for (buttons = 0, i = 1; i < 12; i++)
|
||||||
{
|
{
|
||||||
|
if (i == 8)
|
||||||
|
continue; /* skip id=8 because it doesn't exist, (MB_CLOSE) ?*/
|
||||||
hItem = GetDlgItem(hwnd, i);
|
hItem = GetDlgItem(hwnd, i);
|
||||||
if (GetWindowLongW(hItem, GWL_STYLE) & WS_VISIBLE)
|
if (GetWindowLongW(hItem, GWL_STYLE) & WS_VISIBLE)
|
||||||
{
|
{
|
||||||
|
@ -236,9 +277,9 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb)
|
||||||
}
|
}
|
||||||
bw = max(bw, bh * 2);
|
bw = max(bw, bh * 2);
|
||||||
/* Button white space */
|
/* Button white space */
|
||||||
bh = bh * 2;
|
bh = bh * 2 - 4;
|
||||||
bw = bw * 2;
|
bw = bw * 2;
|
||||||
bspace = bw/3; /* Space between buttons */
|
bspace = 10; /* Fixed space between buttons */
|
||||||
|
|
||||||
/* Get the text size */
|
/* Get the text size */
|
||||||
GetClientRect(GetDlgItem(hwnd, MSGBOX_IDTEXT), &rect);
|
GetClientRect(GetDlgItem(hwnd, MSGBOX_IDTEXT), &rect);
|
||||||
|
@ -256,7 +297,7 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb)
|
||||||
SelectObject(hdc, hPrevFont);
|
SelectObject(hdc, hPrevFont);
|
||||||
ReleaseDC(hItem, hdc);
|
ReleaseDC(hItem, hdc);
|
||||||
|
|
||||||
tiheight = 16 + max(iheight, theight);
|
tiheight = 16 + max(iheight, theight) + 16;
|
||||||
wwidth = tleft + twidth + ileft + borwidth;
|
wwidth = tleft + twidth + ileft + borwidth;
|
||||||
wheight = 8 + tiheight + bh + borheight;
|
wheight = 8 + tiheight + bh + borheight;
|
||||||
|
|
||||||
|
@ -284,6 +325,7 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb)
|
||||||
{
|
{
|
||||||
SetFocus(hItem);
|
SetFocus(hItem);
|
||||||
SendMessageW( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
|
SendMessageW( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
|
||||||
|
sdefbtn = TRUE;
|
||||||
}
|
}
|
||||||
SetWindowPos(hItem, 0, bpos, tiheight, bw, bh,
|
SetWindowPos(hItem, 0, bpos, tiheight, bw, bh,
|
||||||
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
|
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
|
||||||
|
@ -291,6 +333,66 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(lpmb->dwStyle & MB_CANCELTRYCONTINUE)
|
||||||
|
{
|
||||||
|
for (i = 10; i < 12; i++)
|
||||||
|
{
|
||||||
|
hItem = GetDlgItem(hwnd, i);
|
||||||
|
if (GetWindowLongW(hItem, GWL_STYLE) & WS_VISIBLE)
|
||||||
|
{
|
||||||
|
if (buttons++ == ((lpmb->dwStyle & MB_DEFMASK) >> 8))
|
||||||
|
{
|
||||||
|
SetFocus(hItem);
|
||||||
|
SendMessageW( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
|
||||||
|
sdefbtn = TRUE;
|
||||||
|
}
|
||||||
|
SetWindowPos(hItem, 0, bpos, tiheight, bw, bh,
|
||||||
|
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
|
||||||
|
bpos += bw + bspace;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lpmb->dwStyle & MB_HELP)
|
||||||
|
{
|
||||||
|
hItem = GetDlgItem(hwnd, IDHELP);
|
||||||
|
if (GetWindowLongW(hItem, GWL_STYLE) & WS_VISIBLE)
|
||||||
|
{
|
||||||
|
if (buttons++ == ((lpmb->dwStyle & MB_DEFMASK) >> 8))
|
||||||
|
{
|
||||||
|
SetFocus(hItem);
|
||||||
|
SendMessageW( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
|
||||||
|
sdefbtn = TRUE;
|
||||||
|
}
|
||||||
|
SetWindowPos(hItem, 0, bpos, tiheight, bw, bh,
|
||||||
|
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
|
||||||
|
bpos += bw + bspace; /* one extra space */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if there's no (valid) default selection, select first button */
|
||||||
|
if(!sdefbtn)
|
||||||
|
{
|
||||||
|
hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
|
||||||
|
for (buttons = i = 0; i < 7; i++)
|
||||||
|
{
|
||||||
|
hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
|
||||||
|
if (GetWindowLongW(hItem, GWL_STYLE) & WS_VISIBLE)
|
||||||
|
{
|
||||||
|
SetFocus(hItem);
|
||||||
|
SendMessageW( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lpmb->dwStyle & MB_RIGHT)
|
||||||
|
{
|
||||||
|
hItem = GetDlgItem(hwnd, MSGBOX_IDTEXT);
|
||||||
|
SetWindowLong(hItem, GWL_STYLE,
|
||||||
|
GetWindowLong(hItem, GWL_STYLE) | SS_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
/* handle modal MessageBoxes */
|
/* handle modal MessageBoxes */
|
||||||
if (lpmb->dwStyle & (MB_TASKMODAL|MB_SYSTEMMODAL))
|
if (lpmb->dwStyle & (MB_TASKMODAL|MB_SYSTEMMODAL))
|
||||||
{
|
{
|
||||||
|
@ -321,56 +423,69 @@ static INT_PTR CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message,
|
||||||
WPARAM wParam, LPARAM lParam )
|
WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
HFONT hFont;
|
HFONT hFont;
|
||||||
|
HELPINFO hi;
|
||||||
|
|
||||||
switch(message)
|
switch(message) {
|
||||||
{
|
case WM_INITDIALOG:
|
||||||
case WM_INITDIALOG:
|
|
||||||
{
|
|
||||||
LPMSGBOXPARAMS mbp = (LPMSGBOXPARAMS)lParam;
|
|
||||||
SetWindowContextHelpId(hwnd, mbp->dwContextHelpId);
|
|
||||||
hFont = MSGBOX_OnInit(hwnd, mbp);
|
|
||||||
SetPropA(hwnd, "ROS_MSGBOX_HFONT", (HANDLE)hFont);
|
|
||||||
SetPropA(hwnd, "ROS_MSGBOX_HELPCALLBACK", (HANDLE)mbp->lpfnMsgBoxCallback);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case WM_COMMAND:
|
|
||||||
switch (LOWORD(wParam))
|
|
||||||
{
|
|
||||||
case IDOK:
|
|
||||||
case IDCANCEL:
|
|
||||||
case IDABORT:
|
|
||||||
case IDRETRY:
|
|
||||||
case IDIGNORE:
|
|
||||||
case IDYES:
|
|
||||||
case IDNO:
|
|
||||||
hFont = GetPropA(hwnd, "ROS_MSGBOX_HFONT");
|
|
||||||
EndDialog(hwnd, wParam);
|
|
||||||
if (hFont)
|
|
||||||
DeleteObject(hFont);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_HELP:
|
|
||||||
{
|
{
|
||||||
MSGBOXCALLBACK callback = (MSGBOXCALLBACK)GetPropA(hwnd, "ROS_MSGBOX_HELPCALLBACK");
|
if(!GetPropA(hwnd, "ROS_MSGBOX"))
|
||||||
HELPINFO hi;
|
{
|
||||||
|
LPMSGBOXPARAMS mbp = (LPMSGBOXPARAMS)lParam;
|
||||||
memcpy(&hi, (void *)lParam, sizeof(hi));
|
SetWindowContextHelpId(hwnd, mbp->dwContextHelpId);
|
||||||
hi.dwContextId = GetWindowContextHelpId(hwnd);
|
hFont = MSGBOX_OnInit(hwnd, mbp);
|
||||||
|
SetPropA(hwnd, "ROS_MSGBOX", (HANDLE)hwnd);
|
||||||
if (callback)
|
SetPropA(hwnd, "ROS_MSGBOX_HFONT", (HANDLE)hFont);
|
||||||
callback(&hi);
|
SetPropA(hwnd, "ROS_MSGBOX_HELPCALLBACK", (HANDLE)mbp->lpfnMsgBoxCallback);
|
||||||
else
|
}
|
||||||
SendMessageW(GetWindow(hwnd, GW_OWNER), WM_HELP, 0, (LPARAM)&hi);
|
return 0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
case WM_COMMAND:
|
||||||
/* Ok. Ignore all the other messages */
|
switch (LOWORD(wParam))
|
||||||
DbgPrint("Message number 0x%04x is being ignored.\n", message);
|
{
|
||||||
break;
|
case IDOK:
|
||||||
|
case IDCANCEL:
|
||||||
|
case IDABORT:
|
||||||
|
case IDRETRY:
|
||||||
|
case IDIGNORE:
|
||||||
|
case IDYES:
|
||||||
|
case IDNO:
|
||||||
|
case IDTRYAGAIN:
|
||||||
|
case IDCONTINUE:
|
||||||
|
hFont = GetPropA(hwnd, "ROS_MSGBOX_HFONT");
|
||||||
|
EndDialog(hwnd, wParam);
|
||||||
|
if (hFont)
|
||||||
|
DeleteObject(hFont);
|
||||||
|
return 0;
|
||||||
|
case IDHELP:
|
||||||
|
/* send WM_HELP message to messagebox window */
|
||||||
|
hi.cbSize = sizeof(HELPINFO);
|
||||||
|
hi.iContextType = HELPINFO_WINDOW;
|
||||||
|
hi.iCtrlId = LOWORD(wParam);
|
||||||
|
hi.hItemHandle = (HANDLE)lParam;
|
||||||
|
hi.dwContextId = 0;
|
||||||
|
GetCursorPos(&hi.MousePos);
|
||||||
|
SendMessageW(hwnd, WM_HELP, 0, (LPARAM)&hi);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case WM_HELP:
|
||||||
|
{
|
||||||
|
MSGBOXCALLBACK callback = (MSGBOXCALLBACK)GetPropA(hwnd, "ROS_MSGBOX_HELPCALLBACK");
|
||||||
|
|
||||||
|
memcpy(&hi, (void *)lParam, sizeof(hi));
|
||||||
|
hi.dwContextId = GetWindowContextHelpId(hwnd);
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(&hi);
|
||||||
|
else {
|
||||||
|
HWND owner = GetWindow(hwnd, GW_OWNER);
|
||||||
|
if(owner)
|
||||||
|
SendMessageW(GetWindow(hwnd, GW_OWNER), WM_HELP, 0, (LPARAM)&hi);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -510,9 +625,12 @@ STDCALL
|
||||||
MessageBoxIndirectW(
|
MessageBoxIndirectW(
|
||||||
CONST LPMSGBOXPARAMS lpMsgBoxParams)
|
CONST LPMSGBOXPARAMS lpMsgBoxParams)
|
||||||
{
|
{
|
||||||
LPVOID tmplate;
|
LPVOID tmplate, ctmplate;
|
||||||
HRSRC hRes;
|
HRSRC hRes;
|
||||||
HMODULE hUser32;
|
HMODULE hUser32;
|
||||||
|
DWORD ressize;
|
||||||
|
WORD *style;
|
||||||
|
WORD *exstyle;
|
||||||
|
|
||||||
hUser32 = GetModuleHandleW(L"user32.dll");
|
hUser32 = GetModuleHandleW(L"user32.dll");
|
||||||
if (!(hRes = FindResourceExW(hUser32, RT_DIALOGW, L"MSGBOX", lpMsgBoxParams->dwLanguageId)))
|
if (!(hRes = FindResourceExW(hUser32, RT_DIALOGW, L"MSGBOX", lpMsgBoxParams->dwLanguageId)))
|
||||||
|
@ -521,8 +639,33 @@ MessageBoxIndirectW(
|
||||||
if (!(tmplate = (LPVOID)LoadResource(hUser32, hRes)))
|
if (!(tmplate = (LPVOID)LoadResource(hUser32, hRes)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return DialogBoxIndirectParamW(lpMsgBoxParams->hInstance, tmplate, lpMsgBoxParams->hwndOwner,
|
/* Copy template */
|
||||||
|
ressize = SizeofResource(hUser32, hRes);
|
||||||
|
ctmplate = RtlAllocateHeap(RtlGetProcessHeap(), 0, ressize);
|
||||||
|
RtlMoveMemory(ctmplate, tmplate, ressize);
|
||||||
|
|
||||||
|
/* change dialog's style in the template before
|
||||||
|
passing it to DialogBoxIndirectParamW */
|
||||||
|
|
||||||
|
style = (WORD *)ctmplate;
|
||||||
|
exstyle = style + 2;
|
||||||
|
if(*(DWORD*)style == 0xffff0001) /* DIALOGEX resource */
|
||||||
|
{
|
||||||
|
/* skip help id */
|
||||||
|
exstyle = style + 4;
|
||||||
|
style = exstyle + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* change window style before creating it */
|
||||||
|
if(lpMsgBoxParams->dwStyle & MB_RIGHT)
|
||||||
|
*exstyle = (WORD)(*(DWORD*)exstyle | WS_EX_RIGHT);
|
||||||
|
if(lpMsgBoxParams->dwStyle & MB_TOPMOST)
|
||||||
|
*exstyle = (WORD)(*(DWORD*)exstyle | WS_EX_TOPMOST);
|
||||||
|
|
||||||
|
return DialogBoxIndirectParamW(lpMsgBoxParams->hInstance, ctmplate, lpMsgBoxParams->hwndOwner,
|
||||||
MSGBOX_DlgProc, (LPARAM)lpMsgBoxParams);
|
MSGBOX_DlgProc, (LPARAM)lpMsgBoxParams);
|
||||||
|
|
||||||
|
RtlFreeHeap(RtlGetProcessHeap(), 0, ctmplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue