ReactOS 0.4.17-dev-439-g3d86d5e
msgbox.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "shlwapi.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 182 of file msgbox.c.

183{
184 TRACE("(%p,%u,%Id,%Id)\n", hDlg, uMsg, wParam, lParam);
185
186 switch (uMsg)
187 {
188 case WM_INITDIALOG:
189 {
190 DLGDATA *d = (DLGDATA *)lParam;
191 TRACE("WM_INITDIALOG: %p, %s,%s,%ld\n", hDlg, debugstr_w(d->lpszTitle),
192 debugstr_w(d->lpszText), d->dwType);
193
194 SetWindowTextW(hDlg, d->lpszTitle);
195 SetWindowTextW(GetDlgItem(hDlg, IDS_ERR_USER_MSG), d->lpszText);
196
197 /* Set buttons according to dwType */
198 switch (d->dwType)
199 {
200 case 0:
202 /* FIXME: Move OK button to position of the Cancel button (cosmetic) */
203 case 1:
206 break;
207 default:
210 break;
211 }
212 return TRUE;
213 }
214 default:
215 break;
216 }
217 return FALSE;
218}
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:47
#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:779
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:842
#define WM_INITDIALOG
Definition: winuser.h:1767
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define IDNO
Definition: winuser.h:847
#define IDYES
Definition: winuser.h:846

Referenced by SHMessageBoxCheckW().

◆ SHDlgProcEx()

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

Definition at line 56 of file msgbox.c.

57{
59
60 TRACE("(%p,%u,%Id,%Id) data %p\n", hDlg, uMsg, wParam, lParam, d);
61
62 switch (uMsg)
63 {
64 case WM_INITDIALOG:
65 {
66 /* FIXME: Not sure where native stores its lParam */
68 d = (DLGDATAEX *)lParam;
69 TRACE("WM_INITDIALOG: %p, %s,%p,%p\n", hDlg, debugstr_w(d->lpszId),
70 d->dlgProc, (void*)d->lParam);
71 if (d->dlgProc)
72 return d->dlgProc(hDlg, uMsg, wParam, d->lParam);
73 return TRUE;
74 }
75
76 case WM_COMMAND:
77 switch (LOWORD(wParam))
78 {
79 case IDYES:
81 /* Fall through ... */
82 case IDNO:
83 if (LOWORD(wParam) == IDNO)
85 /* Fall through ... */
86 case IDOK:
87 case IDCANCEL:
88
89 TRACE("WM_COMMAND: id=%s data=%p\n",
90 LOWORD(wParam) == IDOK ? "IDOK" : "IDCANCEL", d);
91
93 {
94 DWORD dwZero = 0;
95
96 /* The user clicked 'don't show again', so set the key */
97 SHRegSetUSValueW(szDontShowKey, d->lpszId, REG_DWORD, &dwZero,
98 sizeof(dwZero), SHREGSET_DEFAULT);
99 }
100 if (!d->dlgProc || !d->dlgProc(hDlg, uMsg, wParam, lParam))
101 EndDialog(hDlg, wParam);
102 return TRUE;
103 }
104 break;
105
106 default:
107 break;
108 }
109
110 if (d && d->dlgProc)
111 return d->dlgProc(hDlg, uMsg, wParam, lParam);
112 return FALSE;
113}
LONG WINAPI SHRegSetUSValueW(const WCHAR *subkey, const WCHAR *value, DWORD type, void *data, DWORD data_len, DWORD flags)
Definition: registry.c:3912
static const WCHAR szDontShowKey[]
Definition: msgbox.c:37
#define IDC_ERR_DONT_SHOW
Definition: resource.h:48
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LOWORD(l)
Definition: pedump.c:82
#define SHREGSET_DEFAULT
Definition: shlwapi.h:723
#define REG_DWORD
Definition: sdbapi.c:615
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:883
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define WM_COMMAND
Definition: winuser.h:1768
#define SetWindowLongPtrW
Definition: winuser.h:5512
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BM_GETCHECK
Definition: winuser.h:1947
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 247 of file msgbox.c.

249{
250 WCHAR szTitleBuff[MAX_PATH], szIdBuff[MAX_PATH];
251 WCHAR *szTextBuff = NULL;
252 int iLen;
253 INT_PTR iRetVal;
254
255 if (lpszTitle)
256 MultiByteToWideChar(CP_ACP, 0, lpszTitle, -1, szTitleBuff, MAX_PATH);
257
258 if (lpszText)
259 {
260 iLen = MultiByteToWideChar(CP_ACP, 0, lpszText, -1, NULL, 0);
261 szTextBuff = malloc(iLen * sizeof(WCHAR));
262 MultiByteToWideChar(CP_ACP, 0, lpszText, -1, szTextBuff, iLen);
263 }
264
265 MultiByteToWideChar(CP_ACP, 0, lpszId, -1, szIdBuff, MAX_PATH);
266
267 iRetVal = SHMessageBoxCheckW(hWnd, szTextBuff, lpszTitle ? szTitleBuff : NULL,
268 dwType, iRet, szIdBuff);
269 free(szTextBuff);
270 return iRetVal;
271}
HWND hWnd
Definition: settings.c:17
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define MAX_PATH
Definition: compat.h:34
#define MultiByteToWideChar
Definition: compat.h:110
INT_PTR WINAPI SHMessageBoxCheckW(HWND, LPCWSTR, LPCWSTR, DWORD, INT_PTR, LPCWSTR)
Definition: msgbox.c:278
short WCHAR
Definition: pedump.c:58
int32_t INT_PTR
Definition: typedefs.h:64

◆ SHMessageBoxCheckExA()

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

Definition at line 137 of file msgbox.c.

140{
141 WCHAR szNameBuff[MAX_PATH], szIdBuff[MAX_PATH];
142 LPCWSTR szName = szNameBuff;
143
144 if (IS_INTRESOURCE(lpszName))
145 szName = (LPCWSTR)lpszName; /* Resource Id or NULL */
146 else
147 MultiByteToWideChar(CP_ACP, 0, lpszName, -1, szNameBuff, MAX_PATH);
148
149 MultiByteToWideChar(CP_ACP, 0, lpszId, -1, szIdBuff, MAX_PATH);
150
151 return SHMessageBoxCheckExW(hWnd, hInst, szName, dlgProc, lParam, iRet, szIdBuff);
152}
#define IS_INTRESOURCE(x)
Definition: loader.c:613
INT_PTR WINAPI SHMessageBoxCheckExW(HWND, HINSTANCE, LPCWSTR, DLGPROC, LPARAM, INT_PTR, LPCWSTR)
Definition: msgbox.c:159
HINSTANCE hInst
Definition: dxdiag.c:13
static const WCHAR szName[]
Definition: powrprof.c:45
const uint16_t * LPCWSTR
Definition: typedefs.h:57

◆ SHMessageBoxCheckExW()

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

Definition at line 159 of file msgbox.c.

161{
162 DLGDATAEX d;
163
165 return iRet;
166
167 d.dlgProc = dlgProc;
168 d.lParam = lParam;
169 d.lpszId = lpszId;
170 return DialogBoxParamW(hInst, lpszName, hWnd, SHDlgProcEx, (LPARAM)&d);
171}
BOOL WINAPI SHRegGetBoolUSValueW(const WCHAR *subkey, const WCHAR *value, BOOL ignore_hkcu, BOOL default_value)
Definition: registry.c:4139
static INT_PTR CALLBACK SHDlgProcEx(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: msgbox.c:56
LONG_PTR LPARAM
Definition: minwindef.h:175
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 278 of file msgbox.c.

280{
281 DLGDATA d;
282
283 d.lpszTitle = lpszTitle;
284 d.lpszText = lpszText;
285 d.dwType = dwType;
286
288 SHDlgProc, (LPARAM)&d, iRet, lpszId);
289}
static INT_PTR CALLBACK SHDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: msgbox.c:182
HINSTANCE shlwapi_hInstance
Definition: shlwapi_main.c:33
#define IDD_ERR_DIALOG
Definition: resource.h:46

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(), and SHRestrictedMessageBox().

◆ 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 37 of file msgbox.c.

Referenced by SHDlgProcEx(), and SHMessageBoxCheckExW().