Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Message boxes |
| 3 | * |
| 4 | * Copyright 1995 Bernd Schmidt |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
David Luyer | ee517e8 | 1999-02-28 12:27:56 +0000 | [diff] [blame] | 7 | #include <string.h> |
Patrik Stridvall | 1ed4ecf | 1999-06-26 14:58:24 +0000 | [diff] [blame] | 8 | |
| 9 | #include "wine/winbase16.h" |
Michael Veksler | ca1bc86 | 1999-01-01 18:57:33 +0000 | [diff] [blame] | 10 | #include "wine/winuser16.h" |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 11 | #include "dlgs.h" |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 12 | #include "heap.h" |
Marcus Meissner | d7c565f | 1999-05-14 18:39:37 +0000 | [diff] [blame] | 13 | #include "ldt.h" |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 14 | #include "debugtools.h" |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 15 | #include "debugstr.h" |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 16 | #include "tweak.h" |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 17 | |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 18 | DEFAULT_DEBUG_CHANNEL(dialog) |
| 19 | |
Richard Cohen | d38bcea | 1999-09-03 16:38:03 +0000 | [diff] [blame] | 20 | #define MSGBOX_IDICON 1088 |
| 21 | #define MSGBOX_IDTEXT 100 |
| 22 | |
| 23 | static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSA lpmb) |
| 24 | { |
| 25 | static HFONT hFont = 0, hPrevFont = 0; |
| 26 | RECT rect; |
| 27 | HWND hItem; |
| 28 | HDC hdc; |
| 29 | int i, buttons; |
| 30 | int bspace, bw, bh, theight, tleft, wwidth, wheight, bpos; |
| 31 | int borheight, borwidth, iheight, ileft, iwidth, twidth, tiheight; |
Eric Pouech | cd168e7 | 1999-11-07 23:36:31 +0000 | [diff] [blame] | 32 | LPCSTR lpszText; |
| 33 | char buf[256]; |
| 34 | |
Richard Cohen | d38bcea | 1999-09-03 16:38:03 +0000 | [diff] [blame] | 35 | if (TWEAK_WineLook >= WIN95_LOOK) { |
| 36 | NONCLIENTMETRICSA nclm; |
| 37 | INT i; |
| 38 | nclm.cbSize = sizeof(NONCLIENTMETRICSA); |
| 39 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); |
| 40 | hFont = CreateFontIndirectA (&nclm.lfMessageFont); |
| 41 | /* set button font */ |
| 42 | for (i=1; i < 8; i++) |
| 43 | SendDlgItemMessageA (hwnd, i, WM_SETFONT, (WPARAM)hFont, 0); |
| 44 | /* set text font */ |
| 45 | SendDlgItemMessageA (hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)hFont, 0); |
| 46 | } |
Eric Pouech | cd168e7 | 1999-11-07 23:36:31 +0000 | [diff] [blame] | 47 | if (HIWORD(lpmb->lpszCaption)) { |
| 48 | SetWindowTextA(hwnd, lpmb->lpszCaption); |
| 49 | } else { |
| 50 | if (LoadStringA(lpmb->hInstance, LOWORD(lpmb->lpszCaption), buf, sizeof(buf))) |
| 51 | SetWindowTextA(hwnd, buf); |
| 52 | } |
| 53 | if (HIWORD(lpmb->lpszText)) { |
| 54 | lpszText = lpmb->lpszText; |
| 55 | } else { |
| 56 | lpszText = buf; |
| 57 | if (!LoadStringA(lpmb->hInstance, LOWORD(lpmb->lpszText), buf, sizeof(buf))) |
| 58 | *buf = 0; /* FIXME ?? */ |
| 59 | } |
| 60 | SetWindowTextA(GetDlgItem(hwnd, MSGBOX_IDTEXT), lpszText); |
| 61 | |
Richard Cohen | d38bcea | 1999-09-03 16:38:03 +0000 | [diff] [blame] | 62 | /* Hide not selected buttons */ |
| 63 | switch(lpmb->dwStyle & MB_TYPEMASK) { |
| 64 | case MB_OK: |
| 65 | ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE); |
| 66 | /* fall through */ |
| 67 | case MB_OKCANCEL: |
| 68 | ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE); |
| 69 | ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE); |
| 70 | ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE); |
| 71 | ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE); |
| 72 | ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE); |
| 73 | break; |
| 74 | case MB_ABORTRETRYIGNORE: |
| 75 | ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE); |
| 76 | ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE); |
| 77 | ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE); |
| 78 | ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE); |
| 79 | break; |
| 80 | case MB_YESNO: |
| 81 | ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE); |
| 82 | /* fall through */ |
| 83 | case MB_YESNOCANCEL: |
| 84 | ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE); |
| 85 | ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE); |
| 86 | ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE); |
| 87 | ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE); |
| 88 | break; |
| 89 | case MB_RETRYCANCEL: |
| 90 | ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE); |
| 91 | ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE); |
| 92 | ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE); |
| 93 | ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE); |
| 94 | ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE); |
| 95 | break; |
| 96 | } |
| 97 | /* Set the icon */ |
| 98 | switch(lpmb->dwStyle & MB_ICONMASK) { |
| 99 | case MB_ICONEXCLAMATION: |
| 100 | SendDlgItemMessage16(hwnd, stc1, STM_SETICON16, |
| 101 | (WPARAM16)LoadIcon16(0, IDI_EXCLAMATION16), 0); |
| 102 | break; |
| 103 | case MB_ICONQUESTION: |
| 104 | SendDlgItemMessage16(hwnd, stc1, STM_SETICON16, |
| 105 | (WPARAM16)LoadIcon16(0, IDI_QUESTION16), 0); |
| 106 | break; |
| 107 | case MB_ICONASTERISK: |
| 108 | SendDlgItemMessage16(hwnd, stc1, STM_SETICON16, |
| 109 | (WPARAM16)LoadIcon16(0, IDI_ASTERISK16), 0); |
| 110 | break; |
| 111 | case MB_ICONHAND: |
| 112 | default: |
| 113 | SendDlgItemMessage16(hwnd, stc1, STM_SETICON16, |
| 114 | (WPARAM16)LoadIcon16(0, IDI_HAND16), 0); |
| 115 | break; |
| 116 | } |
| 117 | |
| 118 | /* Position everything */ |
| 119 | GetWindowRect(hwnd, &rect); |
| 120 | borheight = rect.bottom - rect.top; |
| 121 | borwidth = rect.right - rect.left; |
| 122 | GetClientRect(hwnd, &rect); |
| 123 | borheight -= rect.bottom - rect.top; |
| 124 | borwidth -= rect.right - rect.left; |
| 125 | |
| 126 | /* Get the icon height */ |
| 127 | GetWindowRect(GetDlgItem(hwnd, MSGBOX_IDICON), &rect); |
| 128 | MapWindowPoints(0, hwnd, (LPPOINT)&rect, 2); |
| 129 | iheight = rect.bottom - rect.top; |
| 130 | ileft = rect.left; |
| 131 | iwidth = rect.right - ileft; |
| 132 | |
| 133 | hdc = GetDC(hwnd); |
| 134 | if (hFont) |
| 135 | hPrevFont = SelectObject(hdc, hFont); |
| 136 | |
| 137 | /* Get the number of visible buttons and their size */ |
| 138 | bh = bw = 1; /* Minimum button sizes */ |
| 139 | for (buttons = 0, i = 1; i < 8; i++) |
| 140 | { |
| 141 | hItem = GetDlgItem(hwnd, i); |
| 142 | if (GetWindowLongA(hItem, GWL_STYLE) & WS_VISIBLE) |
| 143 | { |
| 144 | char buttonText[1024]; |
| 145 | int w, h; |
| 146 | buttons++; |
| 147 | if (GetWindowTextA(hItem, buttonText, sizeof buttonText)) |
| 148 | { |
| 149 | DrawTextA( hdc, buttonText, -1, &rect, DT_LEFT | DT_EXPANDTABS | DT_CALCRECT); |
| 150 | h = rect.bottom - rect.top; |
| 151 | w = rect.right - rect.left; |
| 152 | if (h > bh) bh = h; |
| 153 | if (w > bw) bw = w ; |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | bw = MAX(bw, bh * 2); |
| 158 | /* Button white space */ |
| 159 | bh = bh * 2; |
| 160 | bw = bw * 2; |
| 161 | bspace = bw/3; /* Space between buttons */ |
| 162 | |
| 163 | /* Get the text size */ |
| 164 | GetClientRect(GetDlgItem(hwnd, MSGBOX_IDTEXT), &rect); |
| 165 | rect.top = rect.left = rect.bottom = 0; |
Eric Pouech | cd168e7 | 1999-11-07 23:36:31 +0000 | [diff] [blame] | 166 | DrawTextA( hdc, lpszText, -1, &rect, |
Richard Cohen | d38bcea | 1999-09-03 16:38:03 +0000 | [diff] [blame] | 167 | DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT); |
| 168 | /* Min text width corresponds to space for the buttons */ |
| 169 | tleft = 2 * ileft + iwidth; |
| 170 | twidth = MAX((bw + bspace) * buttons + bspace - tleft, rect.right); |
| 171 | theight = rect.bottom; |
| 172 | |
| 173 | if (hFont) |
| 174 | SelectObject(hdc, hPrevFont); |
| 175 | ReleaseDC(hItem, hdc); |
| 176 | |
| 177 | tiheight = 16 + MAX(iheight, theight); |
| 178 | wwidth = tleft + twidth + ileft + borwidth; |
| 179 | wheight = 8 + tiheight + bh + borheight; |
| 180 | |
| 181 | /* Resize the window */ |
| 182 | SetWindowPos(hwnd, 0, 0, 0, wwidth, wheight, |
| 183 | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW); |
| 184 | |
| 185 | /* Position the icon */ |
| 186 | SetWindowPos(GetDlgItem(hwnd, MSGBOX_IDICON), 0, ileft, (tiheight - iheight) / 2, 0, 0, |
| 187 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW); |
| 188 | |
| 189 | /* Position the text */ |
| 190 | SetWindowPos(GetDlgItem(hwnd, MSGBOX_IDTEXT), 0, tleft, (tiheight - theight) / 2, twidth, theight, |
| 191 | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW); |
| 192 | |
| 193 | /* Position the buttons */ |
| 194 | bpos = (wwidth - (bw + bspace) * buttons + bspace) / 2; |
| 195 | for (buttons = i = 0; i < 7; i++) { |
| 196 | /* some arithmetic to get the right order for YesNoCancel windows */ |
| 197 | hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1); |
| 198 | if (GetWindowLongA(hItem, GWL_STYLE) & WS_VISIBLE) { |
| 199 | if (buttons++ == ((lpmb->dwStyle & MB_DEFMASK) >> 8)) { |
| 200 | SetFocus(hItem); |
| 201 | SendMessageA( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE ); |
| 202 | } |
| 203 | SetWindowPos(hItem, 0, bpos, tiheight, bw, bh, |
| 204 | SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW); |
| 205 | bpos += bw + bspace; |
| 206 | } |
| 207 | } |
| 208 | return hFont; |
| 209 | } |
| 210 | |
| 211 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 212 | /************************************************************************** |
| 213 | * MSGBOX_DlgProc |
| 214 | * |
| 215 | * Dialog procedure for message boxes. |
| 216 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 217 | static LRESULT CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message, |
| 218 | WPARAM wParam, LPARAM lParam ) |
Richard Cohen | d38bcea | 1999-09-03 16:38:03 +0000 | [diff] [blame] | 219 | { |
Alexandre Julliard | 04699cc | 1999-09-04 11:21:10 +0000 | [diff] [blame] | 220 | static HFONT hFont; |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 221 | switch(message) { |
| 222 | case WM_INITDIALOG: |
Richard Cohen | d38bcea | 1999-09-03 16:38:03 +0000 | [diff] [blame] | 223 | hFont = MSGBOX_OnInit(hwnd, (LPMSGBOXPARAMSA)lParam); |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 224 | return 0; |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 225 | |
| 226 | case WM_COMMAND: |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 227 | switch (wParam) |
| 228 | { |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 229 | case IDOK: |
| 230 | case IDCANCEL: |
| 231 | case IDABORT: |
| 232 | case IDRETRY: |
| 233 | case IDIGNORE: |
| 234 | case IDYES: |
| 235 | case IDNO: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 236 | EndDialog(hwnd, wParam); |
Richard Cohen | d38bcea | 1999-09-03 16:38:03 +0000 | [diff] [blame] | 237 | if (hFont) |
| 238 | DeleteObject(hFont); |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 239 | break; |
| 240 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 241 | |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 242 | default: |
| 243 | /* Ok. Ignore all the other messages */ |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 244 | TRACE("Message number %i is being ignored.\n", message); |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 245 | break; |
| 246 | } |
| 247 | return 0; |
| 248 | } |
| 249 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 250 | |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 251 | /************************************************************************** |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 252 | * MessageBox16 (USER.1) |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 253 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 254 | INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type) |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 255 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 256 | WARN("Messagebox\n"); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 257 | return MessageBoxA( hwnd, text, title, type ); |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 258 | } |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 259 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 260 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 261 | /************************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 262 | * MessageBox32A (USER32.391) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 263 | * |
| 264 | * NOTES |
| 265 | * The WARN is here to help debug erroneous MessageBoxes |
| 266 | * Use: -debugmsg warn+dialog,+relay |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 267 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 268 | INT WINAPI MessageBoxA(HWND hWnd, LPCSTR text, LPCSTR title, UINT type) |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 269 | { |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 270 | LPVOID template; |
| 271 | HRSRC hRes; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 272 | MSGBOXPARAMSA mbox; |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 273 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 274 | WARN("Messagebox\n"); |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 275 | |
| 276 | if(!(hRes = FindResourceA(GetModuleHandleA("USER32"), "MSGBOX", RT_DIALOGA))) |
| 277 | return 0; |
| 278 | if(!(template = (LPVOID)LoadResource(GetModuleHandleA("USER32"), hRes))) |
| 279 | return 0; |
| 280 | |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 281 | if (!text) text="<WINE-NULL>"; |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 282 | if (!title) |
| 283 | title="Error"; |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 284 | mbox.lpszCaption = title; |
| 285 | mbox.lpszText = text; |
| 286 | mbox.dwStyle = type; |
Marcus Meissner | d7c565f | 1999-05-14 18:39:37 +0000 | [diff] [blame] | 287 | return DialogBoxIndirectParamA( GetWindowLongA(hWnd,GWL_HINSTANCE), template, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 288 | hWnd, (DLGPROC)MSGBOX_DlgProc, (LPARAM)&mbox ); |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 289 | } |
| 290 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 291 | |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 292 | /************************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 293 | * MessageBox32W (USER32.396) |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 294 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 295 | INT WINAPI MessageBoxW( HWND hwnd, LPCWSTR text, LPCWSTR title, |
| 296 | UINT type ) |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 297 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 298 | LPSTR titleA = HEAP_strdupWtoA( GetProcessHeap(), 0, title ); |
| 299 | LPSTR textA = HEAP_strdupWtoA( GetProcessHeap(), 0, text ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 300 | INT ret; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 301 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 302 | WARN("Messagebox\n"); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 303 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 304 | ret = MessageBoxA( hwnd, textA, titleA, type ); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 305 | HeapFree( GetProcessHeap(), 0, titleA ); |
| 306 | HeapFree( GetProcessHeap(), 0, textA ); |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 307 | return ret; |
| 308 | } |
| 309 | |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 310 | |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 311 | /************************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 312 | * MessageBoxEx32A (USER32.392) |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 313 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 314 | INT WINAPI MessageBoxExA( HWND hWnd, LPCSTR text, LPCSTR title, |
| 315 | UINT type, WORD langid ) |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 316 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 317 | WARN("Messagebox\n"); |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 318 | /* ignore language id for now */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 319 | return MessageBoxA(hWnd,text,title,type); |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 320 | } |
| 321 | |
| 322 | /************************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 323 | * MessageBoxEx32W (USER32.393) |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 324 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 325 | INT WINAPI MessageBoxExW( HWND hWnd, LPCWSTR text, LPCWSTR title, |
| 326 | UINT type, WORD langid ) |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 327 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 328 | WARN("Messagebox\n"); |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 329 | /* ignore language id for now */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 330 | return MessageBoxW(hWnd,text,title,type); |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 331 | } |
| 332 | |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 333 | /************************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 334 | * MessageBoxIndirect16 (USER.827) |
| 335 | */ |
| 336 | INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox ) |
| 337 | { |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 338 | LPVOID template; |
| 339 | HRSRC hRes; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 340 | MSGBOXPARAMSA msgbox32; |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 341 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 342 | WARN("Messagebox\n"); |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 343 | |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 344 | if(!(hRes = FindResourceA(GetModuleHandleA("USER32"), "MSGBOX", RT_DIALOGA))) |
| 345 | return 0; |
| 346 | if(!(template = (LPVOID)LoadResource(GetModuleHandleA("USER32"), hRes))) |
| 347 | return 0; |
| 348 | |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 349 | msgbox32.cbSize = msgbox->cbSize; |
| 350 | msgbox32.hwndOwner = msgbox->hwndOwner; |
| 351 | msgbox32.hInstance = msgbox->hInstance; |
| 352 | msgbox32.lpszText = PTR_SEG_TO_LIN(msgbox->lpszText); |
| 353 | msgbox32.lpszCaption = PTR_SEG_TO_LIN(msgbox->lpszCaption); |
| 354 | msgbox32.dwStyle = msgbox->dwStyle; |
| 355 | msgbox32.lpszIcon = PTR_SEG_TO_LIN(msgbox->lpszIcon); |
| 356 | msgbox32.dwContextHelpId = msgbox->dwContextHelpId; |
| 357 | msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback; |
| 358 | msgbox32.dwLanguageId = msgbox->dwLanguageId; |
| 359 | |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 360 | return DialogBoxIndirectParamA( msgbox32.hInstance, template, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 361 | msgbox32.hwndOwner, (DLGPROC)MSGBOX_DlgProc, |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 362 | (LPARAM)&msgbox32 ); |
| 363 | } |
| 364 | |
| 365 | /************************************************************************** |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 366 | * MessageBoxIndirect32A (USER32.394) |
| 367 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 368 | INT WINAPI MessageBoxIndirectA( LPMSGBOXPARAMSA msgbox ) |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 369 | { |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 370 | LPVOID template; |
| 371 | HRSRC hRes; |
| 372 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 373 | WARN("Messagebox\n"); |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 374 | |
| 375 | if(!(hRes = FindResourceA(GetModuleHandleA("USER32"), "MSGBOX", RT_DIALOGA))) |
| 376 | return 0; |
| 377 | if(!(template = (LPVOID)LoadResource(GetModuleHandleA("USER32"), hRes))) |
| 378 | return 0; |
| 379 | |
| 380 | return DialogBoxIndirectParamA( msgbox->hInstance, template, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 381 | msgbox->hwndOwner, (DLGPROC)MSGBOX_DlgProc, |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 382 | (LPARAM)msgbox ); |
| 383 | } |
| 384 | |
| 385 | /************************************************************************** |
| 386 | * MessageBoxIndirect32W (USER32.395) |
| 387 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 388 | INT WINAPI MessageBoxIndirectW( LPMSGBOXPARAMSW msgbox ) |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 389 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 390 | MSGBOXPARAMSA msgboxa; |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 391 | WARN("Messagebox\n"); |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 392 | |
| 393 | memcpy(&msgboxa,msgbox,sizeof(msgboxa)); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 394 | if (msgbox->lpszCaption) |
Andreas Mohr | 7a6228d | 1998-12-11 09:16:48 +0000 | [diff] [blame] | 395 | lstrcpyWtoA((LPSTR)msgboxa.lpszCaption,msgbox->lpszCaption); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 396 | if (msgbox->lpszText) |
Andreas Mohr | 7a6228d | 1998-12-11 09:16:48 +0000 | [diff] [blame] | 397 | lstrcpyWtoA((LPSTR)msgboxa.lpszText,msgbox->lpszText); |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 398 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 399 | return MessageBoxIndirectA(&msgboxa); |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 400 | } |
| 401 | |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 402 | |
| 403 | /************************************************************************** |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 404 | * FatalAppExit16 (KERNEL.137) |
| 405 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 406 | void WINAPI FatalAppExit16( UINT16 action, LPCSTR str ) |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 407 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 408 | WARN("AppExit\n"); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 409 | FatalAppExitA( action, str ); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | |
| 413 | /************************************************************************** |
| 414 | * FatalAppExit32A (KERNEL32.108) |
| 415 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 416 | void WINAPI FatalAppExitA( UINT action, LPCSTR str ) |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 417 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 418 | WARN("AppExit\n"); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 419 | MessageBoxA( 0, str, NULL, MB_SYSTEMMODAL | MB_OK ); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 420 | ExitProcess(0); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | |
| 424 | /************************************************************************** |
| 425 | * FatalAppExit32W (KERNEL32.109) |
| 426 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 427 | void WINAPI FatalAppExitW( UINT action, LPCWSTR str ) |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 428 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 429 | WARN("AppExit\n"); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 430 | MessageBoxW( 0, str, NULL, MB_SYSTEMMODAL | MB_OK ); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 431 | ExitProcess(0); |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 432 | } |
Alexandre Julliard | 349a953 | 1997-02-02 19:01:52 +0000 | [diff] [blame] | 433 | |
| 434 | |