blob: 21a9207819a162496b909b146c3be3b3b0aafde2 [file] [log] [blame]
Alexandre Julliard2787be81995-05-22 18:23:01 +00001/*
2 * Message boxes
3 *
4 * Copyright 1995 Bernd Schmidt
Alexandre Julliard2787be81995-05-22 18:23:01 +00005 */
6
David Luyeree517e81999-02-28 12:27:56 +00007#include <string.h>
Michael Vekslerca1bc861999-01-01 18:57:33 +00008#include "wine/winuser16.h"
Alexandre Julliard2787be81995-05-22 18:23:01 +00009#include "dlgs.h"
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000010#include "heap.h"
Marcus Meissnerd7c565f1999-05-14 18:39:37 +000011#include "ldt.h"
Alexandre Julliard54c27111998-03-29 19:44:57 +000012#include "debug.h"
13#include "debugstr.h"
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000014#include "tweak.h"
Alexandre Julliard2787be81995-05-22 18:23:01 +000015
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000016DEFAULT_DEBUG_CHANNEL(dialog)
17
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000018/**************************************************************************
19 * MSGBOX_DlgProc
20 *
21 * Dialog procedure for message boxes.
22 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000023static LRESULT CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message,
24 WPARAM wParam, LPARAM lParam )
Alexandre Julliard2787be81995-05-22 18:23:01 +000025{
Alexandre Julliarda3960291999-02-26 11:11:13 +000026 static HFONT hFont = 0;
27 LPMSGBOXPARAMSA lpmb;
Alexandre Julliard44ed71f1997-12-21 19:17:50 +000028
Alexandre Julliarda3960291999-02-26 11:11:13 +000029 RECT rect, textrect;
30 HWND hItem;
31 HDC hdc;
Alexandre Julliard9ea19e51997-01-01 17:29:55 +000032 LRESULT lRet;
Alexandre Julliard2787be81995-05-22 18:23:01 +000033 int i, buttons, bwidth, bheight, theight, wwidth, bpos;
34 int borheight, iheight, tiheight;
35
36 switch(message) {
37 case WM_INITDIALOG:
Alexandre Julliarda3960291999-02-26 11:11:13 +000038 lpmb = (LPMSGBOXPARAMSA)lParam;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000039 if (TWEAK_WineLook >= WIN95_LOOK) {
Alexandre Julliarda3960291999-02-26 11:11:13 +000040 NONCLIENTMETRICSA nclm;
41 INT i;
42 nclm.cbSize = sizeof(NONCLIENTMETRICSA);
43 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
44 hFont = CreateFontIndirectA (&nclm.lfMessageFont);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000045 /* set button font */
46 for (i=1; i < 8; i++)
Alexandre Julliarda3960291999-02-26 11:11:13 +000047 SendDlgItemMessageA (hwnd, i, WM_SETFONT, (WPARAM)hFont, 0);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000048 /* set text font */
Alexandre Julliarda3960291999-02-26 11:11:13 +000049 SendDlgItemMessageA (hwnd, 100, WM_SETFONT, (WPARAM)hFont, 0);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000050 }
Alexandre Julliarda3960291999-02-26 11:11:13 +000051 if (lpmb->lpszCaption) SetWindowTextA(hwnd, lpmb->lpszCaption);
52 SetWindowTextA(GetDlgItem(hwnd, 100), lpmb->lpszText);
Alexandre Julliard2787be81995-05-22 18:23:01 +000053 /* Hide not selected buttons */
Alexandre Julliard44ed71f1997-12-21 19:17:50 +000054 switch(lpmb->dwStyle & MB_TYPEMASK) {
Alexandre Julliard2787be81995-05-22 18:23:01 +000055 case MB_OK:
Alexandre Julliarda3960291999-02-26 11:11:13 +000056 ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
Alexandre Julliard2787be81995-05-22 18:23:01 +000057 /* fall through */
58 case MB_OKCANCEL:
Alexandre Julliarda3960291999-02-26 11:11:13 +000059 ShowWindow(GetDlgItem(hwnd, 3), SW_HIDE);
60 ShowWindow(GetDlgItem(hwnd, 4), SW_HIDE);
61 ShowWindow(GetDlgItem(hwnd, 5), SW_HIDE);
62 ShowWindow(GetDlgItem(hwnd, 6), SW_HIDE);
63 ShowWindow(GetDlgItem(hwnd, 7), SW_HIDE);
Alexandre Julliard2787be81995-05-22 18:23:01 +000064 break;
65 case MB_ABORTRETRYIGNORE:
Alexandre Julliarda3960291999-02-26 11:11:13 +000066 ShowWindow(GetDlgItem(hwnd, 1), SW_HIDE);
67 ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
68 ShowWindow(GetDlgItem(hwnd, 6), SW_HIDE);
69 ShowWindow(GetDlgItem(hwnd, 7), SW_HIDE);
Alexandre Julliard2787be81995-05-22 18:23:01 +000070 break;
71 case MB_YESNO:
Alexandre Julliarda3960291999-02-26 11:11:13 +000072 ShowWindow(GetDlgItem(hwnd, 2), SW_HIDE);
Alexandre Julliard2787be81995-05-22 18:23:01 +000073 /* fall through */
74 case MB_YESNOCANCEL:
Alexandre Julliarda3960291999-02-26 11:11:13 +000075 ShowWindow(GetDlgItem(hwnd, 1), SW_HIDE);
76 ShowWindow(GetDlgItem(hwnd, 3), SW_HIDE);
77 ShowWindow(GetDlgItem(hwnd, 4), SW_HIDE);
78 ShowWindow(GetDlgItem(hwnd, 5), SW_HIDE);
Alexandre Julliard2787be81995-05-22 18:23:01 +000079 break;
80 }
81 /* Set the icon */
Alexandre Julliard44ed71f1997-12-21 19:17:50 +000082 switch(lpmb->dwStyle & MB_ICONMASK) {
Alexandre Julliard2787be81995-05-22 18:23:01 +000083 case MB_ICONEXCLAMATION:
Alexandre Julliard491502b1997-11-01 19:08:16 +000084 SendDlgItemMessage16(hwnd, stc1, STM_SETICON16,
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000085 (WPARAM16)LoadIcon16(0, IDI_EXCLAMATION16), 0);
Alexandre Julliard2787be81995-05-22 18:23:01 +000086 break;
87 case MB_ICONQUESTION:
Alexandre Julliard491502b1997-11-01 19:08:16 +000088 SendDlgItemMessage16(hwnd, stc1, STM_SETICON16,
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000089 (WPARAM16)LoadIcon16(0, IDI_QUESTION16), 0);
Alexandre Julliard2787be81995-05-22 18:23:01 +000090 break;
91 case MB_ICONASTERISK:
Alexandre Julliard491502b1997-11-01 19:08:16 +000092 SendDlgItemMessage16(hwnd, stc1, STM_SETICON16,
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000093 (WPARAM16)LoadIcon16(0, IDI_ASTERISK16), 0);
Alexandre Julliard2787be81995-05-22 18:23:01 +000094 break;
95 case MB_ICONHAND:
Alexandre Julliardbd34d4f1995-06-20 19:08:12 +000096 default:
Alexandre Julliard491502b1997-11-01 19:08:16 +000097 SendDlgItemMessage16(hwnd, stc1, STM_SETICON16,
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000098 (WPARAM16)LoadIcon16(0, IDI_HAND16), 0);
Alexandre Julliard2787be81995-05-22 18:23:01 +000099 break;
100 }
101
102 /* Position everything */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000103 GetWindowRect(hwnd, &rect);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000104 borheight = rect.bottom - rect.top;
105 wwidth = rect.right - rect.left;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000106 GetClientRect(hwnd, &rect);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000107 borheight -= rect.bottom - rect.top;
108
109 /* Get the icon height */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000110 GetWindowRect(GetDlgItem(hwnd, 1088), &rect);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000111 iheight = rect.bottom - rect.top;
112
113 /* Get the number of visible buttons and their width */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000114 GetWindowRect(GetDlgItem(hwnd, 2), &rect);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000115 bheight = rect.bottom - rect.top;
116 bwidth = rect.left;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000117 GetWindowRect(GetDlgItem(hwnd, 1), &rect);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000118 bwidth -= rect.left;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000119 for (buttons = 0, i = 1; i < 8; i++)
120 {
Alexandre Julliarda3960291999-02-26 11:11:13 +0000121 hItem = GetDlgItem(hwnd, i);
122 if (GetWindowLongA(hItem, GWL_STYLE) & WS_VISIBLE) buttons++;
Alexandre Julliard2787be81995-05-22 18:23:01 +0000123 }
124
125 /* Get the text size */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000126 hItem = GetDlgItem(hwnd, 100);
127 GetWindowRect(hItem, &textrect);
128 MapWindowPoints(0, hwnd, (LPPOINT)&textrect, 2);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000129
Alexandre Julliarda3960291999-02-26 11:11:13 +0000130 GetClientRect(hItem, &rect);
131 hdc = GetDC(hItem);
132 lRet = DrawTextA( hdc, lpmb->lpszText, -1, &rect,
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000133 DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000134 theight = rect.bottom - rect.top;
Alexandre Julliard902da691995-11-05 14:39:02 +0000135 tiheight = 16 + MAX(iheight, theight);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000136 ReleaseDC(hItem, hdc);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000137
138 /* Position the text */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000139 SetWindowPos(hItem, 0, textrect.left, (tiheight - theight) / 2,
Alexandre Julliard01d63461997-01-20 19:43:45 +0000140 rect.right - rect.left, theight,
141 SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000142
143 /* Position the icon */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000144 hItem = GetDlgItem(hwnd, 1088);
145 GetWindowRect(hItem, &rect);
146 MapWindowPoints(0, hwnd, (LPPOINT)&rect, 2);
147 SetWindowPos(hItem, 0, rect.left, (tiheight - iheight) / 2, 0, 0,
Alexandre Julliard01d63461997-01-20 19:43:45 +0000148 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000149
150 /* Resize the window */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000151 SetWindowPos(hwnd, 0, 0, 0, wwidth, 8 + tiheight + bheight + borheight,
Alexandre Julliard01d63461997-01-20 19:43:45 +0000152 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000153
154 /* Position the buttons */
155 bpos = (wwidth - bwidth * buttons) / 2;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000156 GetWindowRect(GetDlgItem(hwnd, 1), &rect);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000157 for (buttons = i = 0; i < 7; i++) {
158 /* some arithmetic to get the right order for YesNoCancel windows */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000159 hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
160 if (GetWindowLongA(hItem, GWL_STYLE) & WS_VISIBLE) {
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000161 if (buttons++ == ((lpmb->dwStyle & MB_DEFMASK) >> 8)) {
Alexandre Julliarda3960291999-02-26 11:11:13 +0000162 SetFocus(hItem);
163 SendMessageA( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
Alexandre Julliard2787be81995-05-22 18:23:01 +0000164 }
Alexandre Julliarda3960291999-02-26 11:11:13 +0000165 SetWindowPos(hItem, 0, bpos, tiheight, 0, 0,
Alexandre Julliard01d63461997-01-20 19:43:45 +0000166 SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000167 bpos += bwidth;
168 }
169 }
170 return 0;
171 break;
172
173 case WM_COMMAND:
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000174 switch (wParam)
175 {
Alexandre Julliard2787be81995-05-22 18:23:01 +0000176 case IDOK:
177 case IDCANCEL:
178 case IDABORT:
179 case IDRETRY:
180 case IDIGNORE:
181 case IDYES:
182 case IDNO:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000183 if ((TWEAK_WineLook > WIN31_LOOK) && hFont)
Alexandre Julliarda3960291999-02-26 11:11:13 +0000184 DeleteObject (hFont);
185 EndDialog(hwnd, wParam);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000186 break;
187 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000188
Alexandre Julliard54c27111998-03-29 19:44:57 +0000189 default:
190 /* Ok. Ignore all the other messages */
191 TRACE (dialog, "Message number %i is being ignored.\n", message);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000192 break;
193 }
194 return 0;
195}
196
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000197
Alexandre Julliard2787be81995-05-22 18:23:01 +0000198/**************************************************************************
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000199 * MessageBox16 (USER.1)
Alexandre Julliard2787be81995-05-22 18:23:01 +0000200 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000201INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type)
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000202{
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000203 WARN(dialog,"Messagebox\n");
Alexandre Julliarda3960291999-02-26 11:11:13 +0000204 return MessageBoxA( hwnd, text, title, type );
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000205}
Alexandre Julliard2787be81995-05-22 18:23:01 +0000206
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000207
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000208/**************************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000209 * MessageBox32A (USER32.391)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000210 *
211 * NOTES
212 * The WARN is here to help debug erroneous MessageBoxes
213 * Use: -debugmsg warn+dialog,+relay
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000214 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000215INT WINAPI MessageBoxA(HWND hWnd, LPCSTR text, LPCSTR title, UINT type)
Alexandre Julliard2787be81995-05-22 18:23:01 +0000216{
Bertho Stultiensd1895a71999-04-25 18:31:35 +0000217 LPVOID template;
218 HRSRC hRes;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000219 MSGBOXPARAMSA mbox;
Bertho Stultiensd1895a71999-04-25 18:31:35 +0000220
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000221 WARN(dialog,"Messagebox\n");
Bertho Stultiensd1895a71999-04-25 18:31:35 +0000222
223 if(!(hRes = FindResourceA(GetModuleHandleA("USER32"), "MSGBOX", RT_DIALOGA)))
224 return 0;
225 if(!(template = (LPVOID)LoadResource(GetModuleHandleA("USER32"), hRes)))
226 return 0;
227
Alexandre Julliard349a9531997-02-02 19:01:52 +0000228 if (!text) text="<WINE-NULL>";
Alexandre Julliard54c27111998-03-29 19:44:57 +0000229 if (!title)
230 title="Error";
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000231 mbox.lpszCaption = title;
232 mbox.lpszText = text;
233 mbox.dwStyle = type;
Marcus Meissnerd7c565f1999-05-14 18:39:37 +0000234 return DialogBoxIndirectParamA( GetWindowLongA(hWnd,GWL_HINSTANCE), template,
Alexandre Julliarda3960291999-02-26 11:11:13 +0000235 hWnd, (DLGPROC)MSGBOX_DlgProc, (LPARAM)&mbox );
Alexandre Julliard2787be81995-05-22 18:23:01 +0000236}
237
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000238
Alexandre Julliard2787be81995-05-22 18:23:01 +0000239/**************************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000240 * MessageBox32W (USER32.396)
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000241 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000242INT WINAPI MessageBoxW( HWND hwnd, LPCWSTR text, LPCWSTR title,
243 UINT type )
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000244{
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000245 LPSTR titleA = HEAP_strdupWtoA( GetProcessHeap(), 0, title );
246 LPSTR textA = HEAP_strdupWtoA( GetProcessHeap(), 0, text );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000247 INT ret;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000248
249 WARN(dialog,"Messagebox\n");
250
Alexandre Julliarda3960291999-02-26 11:11:13 +0000251 ret = MessageBoxA( hwnd, textA, titleA, type );
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000252 HeapFree( GetProcessHeap(), 0, titleA );
253 HeapFree( GetProcessHeap(), 0, textA );
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000254 return ret;
255}
256
Alexandre Julliard2787be81995-05-22 18:23:01 +0000257
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000258/**************************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000259 * MessageBoxEx32A (USER32.392)
Alexandre Julliard349a9531997-02-02 19:01:52 +0000260 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000261INT WINAPI MessageBoxExA( HWND hWnd, LPCSTR text, LPCSTR title,
262 UINT type, WORD langid )
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000263{
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000264 WARN(dialog,"Messagebox\n");
Alexandre Julliard349a9531997-02-02 19:01:52 +0000265 /* ignore language id for now */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000266 return MessageBoxA(hWnd,text,title,type);
Alexandre Julliard349a9531997-02-02 19:01:52 +0000267}
268
269/**************************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000270 * MessageBoxEx32W (USER32.393)
Alexandre Julliard349a9531997-02-02 19:01:52 +0000271 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000272INT WINAPI MessageBoxExW( HWND hWnd, LPCWSTR text, LPCWSTR title,
273 UINT type, WORD langid )
Alexandre Julliard349a9531997-02-02 19:01:52 +0000274{
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000275 WARN(dialog,"Messagebox\n");
Alexandre Julliard349a9531997-02-02 19:01:52 +0000276 /* ignore language id for now */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000277 return MessageBoxW(hWnd,text,title,type);
Alexandre Julliard349a9531997-02-02 19:01:52 +0000278}
279
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000280/**************************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000281 * MessageBoxIndirect16 (USER.827)
282 */
283INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
284{
Bertho Stultiensd1895a71999-04-25 18:31:35 +0000285 LPVOID template;
286 HRSRC hRes;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000287 MSGBOXPARAMSA msgbox32;
Bertho Stultiensd1895a71999-04-25 18:31:35 +0000288
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000289 WARN(dialog,"Messagebox\n");
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000290
Bertho Stultiensd1895a71999-04-25 18:31:35 +0000291 if(!(hRes = FindResourceA(GetModuleHandleA("USER32"), "MSGBOX", RT_DIALOGA)))
292 return 0;
293 if(!(template = (LPVOID)LoadResource(GetModuleHandleA("USER32"), hRes)))
294 return 0;
295
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000296 msgbox32.cbSize = msgbox->cbSize;
297 msgbox32.hwndOwner = msgbox->hwndOwner;
298 msgbox32.hInstance = msgbox->hInstance;
299 msgbox32.lpszText = PTR_SEG_TO_LIN(msgbox->lpszText);
300 msgbox32.lpszCaption = PTR_SEG_TO_LIN(msgbox->lpszCaption);
301 msgbox32.dwStyle = msgbox->dwStyle;
302 msgbox32.lpszIcon = PTR_SEG_TO_LIN(msgbox->lpszIcon);
303 msgbox32.dwContextHelpId = msgbox->dwContextHelpId;
304 msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
305 msgbox32.dwLanguageId = msgbox->dwLanguageId;
306
Bertho Stultiensd1895a71999-04-25 18:31:35 +0000307 return DialogBoxIndirectParamA( msgbox32.hInstance, template,
Alexandre Julliarda3960291999-02-26 11:11:13 +0000308 msgbox32.hwndOwner, (DLGPROC)MSGBOX_DlgProc,
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000309 (LPARAM)&msgbox32 );
310}
311
312/**************************************************************************
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000313 * MessageBoxIndirect32A (USER32.394)
314 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000315INT WINAPI MessageBoxIndirectA( LPMSGBOXPARAMSA msgbox )
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000316{
Bertho Stultiensd1895a71999-04-25 18:31:35 +0000317 LPVOID template;
318 HRSRC hRes;
319
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000320 WARN(dialog,"Messagebox\n");
Bertho Stultiensd1895a71999-04-25 18:31:35 +0000321
322 if(!(hRes = FindResourceA(GetModuleHandleA("USER32"), "MSGBOX", RT_DIALOGA)))
323 return 0;
324 if(!(template = (LPVOID)LoadResource(GetModuleHandleA("USER32"), hRes)))
325 return 0;
326
327 return DialogBoxIndirectParamA( msgbox->hInstance, template,
Alexandre Julliarda3960291999-02-26 11:11:13 +0000328 msgbox->hwndOwner, (DLGPROC)MSGBOX_DlgProc,
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000329 (LPARAM)msgbox );
330}
331
332/**************************************************************************
333 * MessageBoxIndirect32W (USER32.395)
334 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000335INT WINAPI MessageBoxIndirectW( LPMSGBOXPARAMSW msgbox )
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000336{
Alexandre Julliarda3960291999-02-26 11:11:13 +0000337 MSGBOXPARAMSA msgboxa;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000338 WARN(dialog,"Messagebox\n");
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000339
340 memcpy(&msgboxa,msgbox,sizeof(msgboxa));
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000341 if (msgbox->lpszCaption)
Andreas Mohr7a6228d1998-12-11 09:16:48 +0000342 lstrcpyWtoA((LPSTR)msgboxa.lpszCaption,msgbox->lpszCaption);
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000343 if (msgbox->lpszText)
Andreas Mohr7a6228d1998-12-11 09:16:48 +0000344 lstrcpyWtoA((LPSTR)msgboxa.lpszText,msgbox->lpszText);
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000345
Alexandre Julliarda3960291999-02-26 11:11:13 +0000346 return MessageBoxIndirectA(&msgboxa);
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000347}
348
Alexandre Julliard349a9531997-02-02 19:01:52 +0000349
350/**************************************************************************
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000351 * FatalAppExit16 (KERNEL.137)
352 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000353void WINAPI FatalAppExit16( UINT16 action, LPCSTR str )
Alexandre Julliard2787be81995-05-22 18:23:01 +0000354{
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000355 WARN(dialog,"AppExit\n");
Alexandre Julliarda3960291999-02-26 11:11:13 +0000356 FatalAppExitA( action, str );
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000357}
358
359
360/**************************************************************************
361 * FatalAppExit32A (KERNEL32.108)
362 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000363void WINAPI FatalAppExitA( UINT action, LPCSTR str )
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000364{
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000365 WARN(dialog,"AppExit\n");
Alexandre Julliarda3960291999-02-26 11:11:13 +0000366 MessageBoxA( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000367 ExitProcess(0);
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000368}
369
370
371/**************************************************************************
372 * FatalAppExit32W (KERNEL32.109)
373 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000374void WINAPI FatalAppExitW( UINT action, LPCWSTR str )
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000375{
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000376 WARN(dialog,"AppExit\n");
Alexandre Julliarda3960291999-02-26 11:11:13 +0000377 MessageBoxW( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000378 ExitProcess(0);
Alexandre Julliard2787be81995-05-22 18:23:01 +0000379}
Alexandre Julliard349a9531997-02-02 19:01:52 +0000380
381