Fix copy/paste bug. Make MessageBox without an icon look better.

This commit is contained in:
Dmitry Timoshkov 2002-11-11 19:52:33 +00:00 committed by Alexandre Julliard
parent b6c3d0cbd8
commit 46c80c8876
1 changed files with 9 additions and 3 deletions

View File

@ -70,7 +70,7 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
} }
else else
{ {
if (LoadStringW(0, IDS_ERROR, buf, 256)) if (LoadStringW(GetModuleHandleA("user32.dll"), IDS_ERROR, buf, 256))
SetWindowTextW(hwnd, buf); SetWindowTextW(hwnd, buf);
} }
} }
@ -158,6 +158,11 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
/* Get the icon height */ /* Get the icon height */
GetWindowRect(GetDlgItem(hwnd, MSGBOX_IDICON), &rect); GetWindowRect(GetDlgItem(hwnd, MSGBOX_IDICON), &rect);
MapWindowPoints(0, hwnd, (LPPOINT)&rect, 2); MapWindowPoints(0, hwnd, (LPPOINT)&rect, 2);
if (!(lpmb->dwStyle & MB_ICONMASK))
{
rect.bottom = rect.top;
rect.right = rect.left;
}
iheight = rect.bottom - rect.top; iheight = rect.bottom - rect.top;
ileft = rect.left; ileft = rect.left;
iwidth = rect.right - ileft; iwidth = rect.right - ileft;
@ -198,7 +203,8 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
DrawTextW( hdc, lpszText, -1, &rect, DrawTextW( hdc, lpszText, -1, &rect,
DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT); DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT);
/* Min text width corresponds to space for the buttons */ /* Min text width corresponds to space for the buttons */
tleft = 2 * ileft + iwidth; tleft = ileft;
if (iwidth) tleft += ileft + iwidth;
twidth = max((bw + bspace) * buttons + bspace - tleft, rect.right); twidth = max((bw + bspace) * buttons + bspace - tleft, rect.right);
theight = rect.bottom; theight = rect.bottom;
@ -407,7 +413,7 @@ INT WINAPI MessageBoxIndirectA( LPMSGBOXPARAMSA msgbox )
if (HIWORD(msgbox->lpszIcon)) if (HIWORD(msgbox->lpszIcon))
RtlCreateUnicodeStringFromAsciiz(&iconW, msgbox->lpszIcon); RtlCreateUnicodeStringFromAsciiz(&iconW, msgbox->lpszIcon);
else else
captionW.Buffer = (LPWSTR)msgbox->lpszIcon; iconW.Buffer = (LPWSTR)msgbox->lpszIcon;
msgboxW.cbSize = sizeof(msgboxW); msgboxW.cbSize = sizeof(msgboxW);
msgboxW.hwndOwner = msgbox->hwndOwner; msgboxW.hwndOwner = msgbox->hwndOwner;