ReactOS 0.4.15-dev-7788-g1ad9096
messagebox.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include "resource.h"
Include dependency graph for messagebox.c:

Go to the source code of this file.

Classes

struct  _MSGBOXDATA
 

Macros

#define _WIN32_WINNT   _WIN32_WINNT_WS03
 

Typedefs

typedef struct _MSGBOXDATA MSGBOXDATA
 
typedef struct _MSGBOXDATAPMSGBOXDATA
 
typedef struct _MSGBOXDATALPMSGBOXDATA
 

Functions

 C_ASSERT (sizeof(MSGBOXDATA)==0x48)
 
void TestSoftModalMsgBox (void)
 
void TestMsgBoxServiceNotification (void)
 
int wmain (int argc, WCHAR *argv[])
 

Macro Definition Documentation

◆ _WIN32_WINNT

#define _WIN32_WINNT   _WIN32_WINNT_WS03

Definition at line 21 of file messagebox.c.

Typedef Documentation

◆ LPMSGBOXDATA

◆ MSGBOXDATA

◆ PMSGBOXDATA

Function Documentation

◆ C_ASSERT()

C_ASSERT ( sizeof(MSGBOXDATA = =0x48)

◆ TestMsgBoxServiceNotification()

void TestMsgBoxServiceNotification ( void  )

Definition at line 121 of file messagebox.c.

122{
123 int res;
124
125 res = MessageBoxW(NULL, L"Hello World!", L"MB_SERVICE_NOTIFICATION",
126 MB_YESNOCANCEL | MB_DEFBUTTON3 | MB_ICONINFORMATION | /* MB_DEFAULT_DESKTOP_ONLY | */ MB_SERVICE_NOTIFICATION);
127 printf("Returned value = %i\n", res);
128}
#define NULL
Definition: types.h:112
#define printf
Definition: freeldr.h:93
GLuint res
Definition: glext.h:9613
#define L(x)
Definition: ntvdm.h:50
#define MB_DEFBUTTON3
Definition: winuser.h:800
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONINFORMATION
Definition: winuser.h:802
#define MB_YESNOCANCEL
Definition: winuser.h:818

Referenced by wmain().

◆ TestSoftModalMsgBox()

void TestSoftModalMsgBox ( void  )

Definition at line 71 of file messagebox.c.

72{
73 typedef int (WINAPI *SOFTMODALMESSAGEBOX)(LPMSGBOXDATA lpMsgBoxData);
74 // int WINAPI SoftModalMessageBox(IN LPMSGBOXDATA lpMsgBoxData);
75 SOFTMODALMESSAGEBOX SoftModalMessageBox = NULL;
76
78 int res = 0;
79
80 INT pids[] =
81 {
82 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 /*, 2*/
83 };
84 /* NOTE: Buttons do NOT support resource IDs specifications! */
85 LPCWSTR ppText[] =
86 {
87 L"Button 1", L"Button 2", L"Button 3", L"Button 4", L"Button 5", L"Button 6", L"Button 7", L"Button 8", L"Button 9", L"Button 10", L"Button 11", L"Button 12", L"Button 13"
88 };
89
90 ZeroMemory(&data, sizeof(data));
91 data.mbp.cbSize = sizeof(data.mbp);
92 data.mbp.hwndOwner = FindWindowW(L"Shell_TrayWnd", NULL);
93 data.mbp.hInstance = GetModuleHandleW(NULL);
94 data.mbp.lpszText = L"This is a message box made using the undocumented SoftModalMessageBox() API.";
95 data.mbp.lpszCaption = MAKEINTRESOURCEW(IDS_RES_CAPTION); // L"SoftModalMessageBox";
96 data.mbp.lpfnMsgBoxCallback = NULL; // SoftModalMessageBoxCallback;
98
99 data.wLanguageId = 0;
100 data.pidButton = pids;
101 data.ppszButtonText = ppText;
102 data.dwButtons = _countof(pids);
103 data.uDefButton = 2;
104 data.uCancelId = 0;
105#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP) /* (NTDDI_VERSION >= NTDDI_WINXP) */
106 data.dwTimeout = 3 * 1000;
107#endif
108
109 SoftModalMessageBox = (SOFTMODALMESSAGEBOX)GetProcAddress(GetModuleHandleW(L"user32.dll"), "SoftModalMessageBox");
111 {
112 printf("SoftModalMessageBoxW not found in user32.dll\n");
113 }
114 else
115 {
117 printf("Returned value = %i\n", res);
118 }
119}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define IDS_RES_CAPTION
Definition: resource.h:1
#define _countof(array)
Definition: sndvol32.h:68
int32_t INT
Definition: typedefs.h:58
int WINAPI SoftModalMessageBox(IN LPMSGBOXDATA lpMsgBoxData)
Definition: messagebox.c:617
#define ZeroMemory
Definition: winbase.h:1712
#define WINAPI
Definition: msvc.h:6
#define MB_RETRYCANCEL
Definition: winuser.h:805
HWND WINAPI FindWindowW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by wmain().

◆ wmain()

int wmain ( int  argc,
WCHAR argv[] 
)

Definition at line 130 of file messagebox.c.

131{
132 printf("Testing SoftModalMessageBox()...\n");
134 printf("\n");
135
136 printf("Press any key to continue...\n");
137 _getch();
138 printf("\n");
139
140 printf("Testing MB_SERVICE_NOTIFICATION...\n");
142 printf("\n");
143
144 printf("Press any key to quit...\n");
145 _getch();
146 return 0;
147}
void TestSoftModalMsgBox(void)
Definition: messagebox.c:71
void TestMsgBoxServiceNotification(void)
Definition: messagebox.c:121
int _getch()
Definition: getch.c:16