ReactOS 0.4.15-dev-7958-gcd0bb1a
msgbox.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "shlwapi.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "resource.h"
Include dependency graph for msgbox.c:

Go to the source code of this file.

Classes

struct  tagDLGDATAEX
 
struct  tagDLGDATA
 

Typedefs

typedef struct tagDLGDATAEX DLGDATAEX
 
typedef struct tagDLGDATA DLGDATA
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
INT_PTR WINAPI SHMessageBoxCheckExW (HWND, HINSTANCE, LPCWSTR, DLGPROC, LPARAM, INT_PTR, LPCWSTR)
 
INT_PTR WINAPI SHMessageBoxCheckW (HWND, LPCWSTR, LPCWSTR, DWORD, INT_PTR, LPCWSTR)
 
static INT_PTR CALLBACK SHDlgProcEx (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR WINAPI SHMessageBoxCheckExA (HWND hWnd, HINSTANCE hInst, LPCSTR lpszName, DLGPROC dlgProc, LPARAM lParam, INT_PTR iRet, LPCSTR lpszId)
 
static INT_PTR CALLBACK SHDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR WINAPI SHMessageBoxCheckA (HWND hWnd, LPCSTR lpszText, LPCSTR lpszTitle, DWORD dwType, INT_PTR iRet, LPCSTR lpszId)
 

Variables

HINSTANCE shlwapi_hInstance
 
static const WCHAR szDontShowKey []
 

Typedef Documentation

◆ DLGDATA

◆ DLGDATAEX

Function Documentation

◆ SHDlgProc()

static INT_PTR CALLBACK SHDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 186 of file msgbox.c.

187{
188 TRACE("(%p,%u,%ld,%ld)\n", hDlg, uMsg, wParam, lParam);
189
190 switch (uMsg)
191 {
192 case WM_INITDIALOG:
193 {
194 DLGDATA *d = (DLGDATA *)lParam;
195 TRACE("WM_INITDIALOG: %p, %s,%s,%d\n", hDlg, debugstr_w(d->lpszTitle),
196 debugstr_w(d->lpszText), d->dwType);
197
198 SetWindowTextW(hDlg, d->lpszTitle);
199 SetWindowTextW(GetDlgItem(hDlg, IDS_ERR_USER_MSG), d->lpszText);
200
201 /* Set buttons according to dwType */
202 switch (d->dwType)
203 {
204 case 0:
206 /* FIXME: Move OK button to position of the Cancel button (cosmetic) */
207 case 1:
210 break;
211 default:
214 break;
215 }
216 return TRUE;
217 }
218 default:
219 break;
220 }
221 return FALSE;
222}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_ERR_USER_MSG
Definition: resource.h:41
#define d
Definition: ke_i.h:81
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:831
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define IDNO
Definition: winuser.h:836
#define IDYES
Definition: winuser.h:835

Referenced by SHMessageBoxCheckW().

◆ SHDlgProcEx()

static INT_PTR CALLBACK SHDlgProcEx ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 60 of file msgbox.c.

61{
63
64 TRACE("(%p,%u,%ld,%ld) data %p\n", hDlg, uMsg, wParam, lParam, d);
65
66 switch (uMsg)
67 {
68 case WM_INITDIALOG:
69 {
70 /* FIXME: Not sure where native stores its lParam */
72 d = (DLGDATAEX *)lParam;
73 TRACE("WM_INITDIALOG: %p, %s,%p,%p\n", hDlg, debugstr_w(d->lpszId),
74 d->dlgProc, (void*)d->lParam);
75 if (d->dlgProc)
76 return d->dlgProc(hDlg, uMsg, wParam, d->lParam);
77 return TRUE;
78 }
79
80 case WM_COMMAND:
81 switch (LOWORD(wParam))
82 {
83 case IDYES:
85 /* Fall through ... */
86 case IDNO:
87 if (LOWORD(wParam) == IDNO)
89 /* Fall through ... */
90 case IDOK:
91 case IDCANCEL:
92
93 TRACE("WM_COMMAND: id=%s data=%p\n",
94 LOWORD(wParam) == IDOK ? "IDOK" : "IDCANCEL", d);
95
97 {
98 DWORD dwZero = 0;
99
100 /* The user clicked 'don't show again', so set the key */
101 SHRegSetUSValueW(szDontShowKey, d->lpszId, REG_DWORD, &dwZero,
102 sizeof(dwZero), SHREGSET_DEFAULT);
103 }
104 if (!d->dlgProc || !d->dlgProc(hDlg, uMsg, wParam, lParam))
105 EndDialog(hDlg, wParam);
106 return TRUE;
107 }
108 break;
109
110 default:
111 break;
112 }
113
114 if (d && d->dlgProc)
115 return d->dlgProc(hDlg, uMsg, wParam, lParam);
116 return FALSE;
117}
static const WCHAR szDontShowKey[]
Definition: msgbox.c:41
LONG WINAPI SHRegSetUSValueW(LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
Definition: reg.c:673
#define IDC_ERR_DONT_SHOW
Definition: resource.h:42
unsigned long DWORD
Definition: ntddk_ex.h:95
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define REG_DWORD
Definition: sdbapi.c:596
#define SHREGSET_DEFAULT
Definition: shlwapi.h:315
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:872
#define GetWindowLongPtrW
Definition: winuser.h:4829
#define WM_COMMAND
Definition: winuser.h:1740
#define SetWindowLongPtrW
Definition: winuser.h:5346
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BM_GETCHECK
Definition: winuser.h:1918
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by SHMessageBoxCheckExW().

◆ SHMessageBoxCheckA()

INT_PTR WINAPI SHMessageBoxCheckA ( HWND  hWnd,
LPCSTR  lpszText,
LPCSTR  lpszTitle,
DWORD  dwType,
INT_PTR  iRet,
LPCSTR  lpszId 
)

Definition at line 251 of file msgbox.c.

253{
254 WCHAR szTitleBuff[MAX_PATH], szIdBuff[MAX_PATH];
255 WCHAR *szTextBuff = NULL;
256 int iLen;
257 INT_PTR iRetVal;
258
259 if (lpszTitle)
260 MultiByteToWideChar(CP_ACP, 0, lpszTitle, -1, szTitleBuff, MAX_PATH);
261
262 if (lpszText)
263 {
264 iLen = MultiByteToWideChar(CP_ACP, 0, lpszText, -1, NULL, 0);
265 szTextBuff = HeapAlloc(GetProcessHeap(), 0, iLen * sizeof(WCHAR));
266 MultiByteToWideChar(CP_ACP, 0, lpszText, -1, szTextBuff, iLen);
267 }
268
269 MultiByteToWideChar(CP_ACP, 0, lpszId, -1, szIdBuff, MAX_PATH);
270
271 iRetVal = SHMessageBoxCheckW(hWnd, szTextBuff, lpszTitle ? szTitleBuff : NULL,
272 dwType, iRet, szIdBuff);
273 HeapFree(GetProcessHeap(), 0, szTextBuff);
274 return iRetVal;
275}
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
INT_PTR WINAPI SHMessageBoxCheckW(HWND, LPCWSTR, LPCWSTR, DWORD, INT_PTR, LPCWSTR)
Definition: msgbox.c:282
int32_t INT_PTR
Definition: typedefs.h:64
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ SHMessageBoxCheckExA()

INT_PTR WINAPI SHMessageBoxCheckExA ( HWND  hWnd,
HINSTANCE  hInst,
LPCSTR  lpszName,
DLGPROC  dlgProc,
LPARAM  lParam,
INT_PTR  iRet,
LPCSTR  lpszId 
)

Definition at line 141 of file msgbox.c.

144{
145 WCHAR szNameBuff[MAX_PATH], szIdBuff[MAX_PATH];
146 LPCWSTR szName = szNameBuff;
147
148 if (IS_INTRESOURCE(lpszName))
149 szName = (LPCWSTR)lpszName; /* Resource Id or NULL */
150 else
151 MultiByteToWideChar(CP_ACP, 0, lpszName, -1, szNameBuff, MAX_PATH);
152
153 MultiByteToWideChar(CP_ACP, 0, lpszId, -1, szIdBuff, MAX_PATH);
154
155 return SHMessageBoxCheckExW(hWnd, hInst, szName, dlgProc, lParam, iRet, szIdBuff);
156}
INT_PTR WINAPI SHMessageBoxCheckExW(HWND, HINSTANCE, LPCWSTR, DLGPROC, LPARAM, INT_PTR, LPCWSTR)
Definition: msgbox.c:163
HINSTANCE hInst
Definition: dxdiag.c:13
static const WCHAR szName[]
Definition: powrprof.c:45
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ SHMessageBoxCheckExW()

INT_PTR WINAPI SHMessageBoxCheckExW ( HWND  hWnd,
HINSTANCE  hInst,
LPCWSTR  lpszName,
DLGPROC  dlgProc,
LPARAM  lParam,
INT_PTR  iRet,
LPCWSTR  lpszId 
)

Definition at line 163 of file msgbox.c.

165{
166 DLGDATAEX d;
167
169 return iRet;
170
171 d.dlgProc = dlgProc;
172 d.lParam = lParam;
173 d.lpszId = lpszId;
174 return DialogBoxParamW(hInst, lpszName, hWnd, SHDlgProcEx, (LPARAM)&d);
175}
static INT_PTR CALLBACK SHDlgProcEx(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: msgbox.c:60
BOOL WINAPI SHRegGetBoolUSValueW(LPCWSTR pszSubKey, LPCWSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault)
Definition: reg.c:770
LONG_PTR LPARAM
Definition: windef.h:208
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by SHMessageBoxCheckExA(), and SHMessageBoxCheckW().

◆ SHMessageBoxCheckW()

INT_PTR WINAPI SHMessageBoxCheckW ( HWND  hWnd,
LPCWSTR  lpszText,
LPCWSTR  lpszTitle,
DWORD  dwType,
INT_PTR  iRet,
LPCWSTR  lpszId 
)

Definition at line 282 of file msgbox.c.

284{
285 DLGDATA d;
286
287 d.lpszTitle = lpszTitle;
288 d.lpszText = lpszText;
289 d.dwType = dwType;
290
292 SHDlgProc, (LPARAM)&d, iRet, lpszId);
293}
static INT_PTR CALLBACK SHDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: msgbox.c:186
HINSTANCE shlwapi_hInstance
Definition: shlwapi_main.c:33
#define IDD_ERR_DIALOG
Definition: resource.h:40

Referenced by SHMessageBoxCheckA().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ shlwapi_hInstance

HINSTANCE shlwapi_hInstance
extern

Definition at line 33 of file shlwapi_main.c.

Referenced by SHMessageBoxCheckW().

◆ szDontShowKey

const WCHAR szDontShowKey[]
static
Initial value:
= { 'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'E','x','p','l','o','r','e','r','\\','D','o','n','t','S','h','o','w',
'M','e','T','h','i','s','D','i','a','l','o','g','A','g','a','i','n','\0'
}

Definition at line 41 of file msgbox.c.

Referenced by SHDlgProcEx(), and SHMessageBoxCheckExW().