mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SYSDM] Make ResourceMessageBox() support printf-like messages. (#4844)
+ Make usage of this new functionality. + Cleanup precomp.h.
This commit is contained in:
parent
a4274ad548
commit
a8e06d92e8
9 changed files with 93 additions and 90 deletions
|
@ -11,9 +11,6 @@
|
|||
#include <commctrl.h>
|
||||
#include <commdlg.h>
|
||||
#include <string.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
#define MAX_STR_LENGTH 128
|
||||
|
||||
typedef struct _VARIABLE_DATA
|
||||
{
|
||||
|
@ -986,16 +983,11 @@ EditVariableDlgProc(HWND hwndDlg,
|
|||
|
||||
case IDC_BUTTON_EDIT_TEXT:
|
||||
{
|
||||
TCHAR szStr[MAX_STR_LENGTH] = _T("");
|
||||
TCHAR szStr2[MAX_STR_LENGTH] = _T("");
|
||||
|
||||
LoadString(hApplet, IDS_ENVIRONMENT_WARNING, szStr, _countof(szStr));
|
||||
LoadString(hApplet, IDS_ENVIRONMENT_WARNING_TITLE, szStr2, _countof(szStr2));
|
||||
|
||||
if (MessageBox(hwndDlg,
|
||||
szStr,
|
||||
szStr2,
|
||||
MB_OKCANCEL | MB_ICONWARNING | MB_DEFBUTTON1) == IDOK)
|
||||
if (ResourceMessageBox(hApplet,
|
||||
hwndDlg,
|
||||
MB_OKCANCEL | MB_ICONWARNING | MB_DEFBUTTON1,
|
||||
IDS_ENVIRONMENT_WARNING_TITLE,
|
||||
IDS_ENVIRONMENT_WARNING) == IDOK)
|
||||
{
|
||||
EndDialog(hwndDlg, -1);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <winnls.h>
|
||||
#include <powrprof.h>
|
||||
#include <buildno.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
#define ANIM_STEP 2
|
||||
#define ANIM_TIME 50
|
||||
|
|
|
@ -121,13 +121,17 @@ CopyProfileDlgProc(
|
|||
pProfileNames->szDestinationName,
|
||||
PROFILE_NAME_LENGTH);
|
||||
if (IsProfileNameInUse(pProfileNames, FALSE))
|
||||
{
|
||||
ResourceMessageBox(hApplet,
|
||||
NULL,
|
||||
hwndDlg,
|
||||
MB_OK | MB_ICONERROR,
|
||||
IDS_HWPROFILE_WARNING,
|
||||
IDS_HWPROFILE_ALREADY_IN_USE);
|
||||
}
|
||||
else
|
||||
{
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
|
@ -238,13 +242,17 @@ RenameProfileDlgProc(
|
|||
pProfileNames->szDestinationName,
|
||||
PROFILE_NAME_LENGTH);
|
||||
if (IsProfileNameInUse(pProfileNames, TRUE))
|
||||
{
|
||||
ResourceMessageBox(hApplet,
|
||||
NULL,
|
||||
hwndDlg,
|
||||
MB_OK | MB_ICONERROR,
|
||||
IDS_HWPROFILE_WARNING,
|
||||
IDS_HWPROFILE_ALREADY_IN_USE);
|
||||
}
|
||||
else
|
||||
{
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
|
@ -303,23 +311,20 @@ DeleteHardwareProfile(
|
|||
HWND hwndDlg,
|
||||
PPROFILEDATA pProfileData)
|
||||
{
|
||||
WCHAR szMessage[256];
|
||||
WCHAR szBuffer[128];
|
||||
WCHAR szCaption[80];
|
||||
PPROFILE pProfiles;
|
||||
PPROFILE pProfile;
|
||||
|
||||
pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
|
||||
|
||||
LoadStringW(hApplet, IDS_HWPROFILE_CONFIRM_DELETE_TITLE, szCaption, sizeof(szCaption) / sizeof(WCHAR));
|
||||
LoadStringW(hApplet, IDS_HWPROFILE_CONFIRM_DELETE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
|
||||
swprintf(szMessage, szBuffer, pProfile->szFriendlyName);
|
||||
|
||||
if (MessageBox(NULL,
|
||||
szMessage,
|
||||
szCaption,
|
||||
MB_YESNO | MB_ICONQUESTION) != IDYES)
|
||||
if (ResourceMessageBox(hApplet,
|
||||
hwndDlg,
|
||||
MB_YESNO | MB_ICONQUESTION,
|
||||
IDS_HWPROFILE_CONFIRM_DELETE_TITLE,
|
||||
IDS_HWPROFILE_CONFIRM_DELETE,
|
||||
pProfile->szFriendlyName) != IDYES)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_DELETESTRING, pProfileData->dwSelectedProfileIndex, 0);
|
||||
|
||||
|
|
|
@ -21,16 +21,18 @@
|
|||
#include <setupapi.h>
|
||||
#include <cpl.h>
|
||||
|
||||
#include <strsafe.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define NUM_APPLETS (1)
|
||||
|
||||
typedef struct _APPLET
|
||||
{
|
||||
int idIcon;
|
||||
int idName;
|
||||
int idDescription;
|
||||
APPLET_PROC AppletProc;
|
||||
int idIcon;
|
||||
int idName;
|
||||
int idDescription;
|
||||
APPLET_PROC AppletProc;
|
||||
} APPLET, *PAPPLET;
|
||||
|
||||
extern HINSTANCE hApplet;
|
||||
|
@ -53,45 +55,15 @@ INT_PTR CALLBACK LicenceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
|
|||
/* System information */
|
||||
BOOL GetSystemName(PWSTR pBuf, SIZE_T cchBuf);
|
||||
|
||||
typedef struct _PAGEFILE
|
||||
{
|
||||
TCHAR szDrive[3];
|
||||
LPTSTR pszVolume;
|
||||
INT OldMinSize;
|
||||
INT OldMaxSize;
|
||||
INT NewMinSize;
|
||||
INT NewMaxSize;
|
||||
UINT FreeSize;
|
||||
BOOL bUsed;
|
||||
} PAGEFILE, *PPAGEFILE;
|
||||
#define MAX_STR_LENGTH 256
|
||||
|
||||
typedef struct _VIRTMEM
|
||||
{
|
||||
HWND hSelf;
|
||||
HWND hListBox;
|
||||
LPTSTR szPagingFiles;
|
||||
TCHAR szDrive[10];
|
||||
INT Count;
|
||||
BOOL bModified;
|
||||
PAGEFILE Pagefile[26];
|
||||
} VIRTMEM, *PVIRTMEM;
|
||||
|
||||
typedef struct _BOOTRECORD
|
||||
{
|
||||
DWORD BootType;
|
||||
WCHAR szSectionName[128];
|
||||
WCHAR szBootPath[MAX_PATH];
|
||||
WCHAR szOptions[512];
|
||||
|
||||
}BOOTRECORD, *PBOOTRECORD;
|
||||
|
||||
INT
|
||||
INT __cdecl
|
||||
ResourceMessageBox(
|
||||
IN HINSTANCE hInstance,
|
||||
IN HWND hwnd,
|
||||
IN UINT uType,
|
||||
IN UINT uCaption,
|
||||
IN UINT uText);
|
||||
|
||||
_In_opt_ HINSTANCE hInstance,
|
||||
_In_opt_ HWND hwnd,
|
||||
_In_ UINT uType,
|
||||
_In_ UINT uCaption,
|
||||
_In_ UINT uText,
|
||||
...);
|
||||
|
||||
#endif /* __CPL_SYSDM_H */
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <strsafe.h>
|
||||
#include <udmihelp.h>
|
||||
|
||||
typedef struct GENERIC_NAME
|
||||
|
|
|
@ -12,6 +12,14 @@
|
|||
|
||||
#include <shlwapi.h>
|
||||
|
||||
typedef struct _BOOTRECORD
|
||||
{
|
||||
DWORD BootType;
|
||||
WCHAR szSectionName[128];
|
||||
WCHAR szBootPath[MAX_PATH];
|
||||
WCHAR szOptions[512];
|
||||
} BOOTRECORD, *PBOOTRECORD;
|
||||
|
||||
typedef struct _STARTINFO
|
||||
{
|
||||
WCHAR szFreeldrIni[MAX_PATH + 15];
|
||||
|
|
|
@ -23,22 +23,30 @@ APPLET Applets[NUM_APPLETS] =
|
|||
#define MAX_SYSTEM_PAGES 32
|
||||
|
||||
|
||||
INT
|
||||
INT __cdecl
|
||||
ResourceMessageBox(
|
||||
IN HINSTANCE hInstance,
|
||||
IN HWND hwnd,
|
||||
IN UINT uType,
|
||||
IN UINT uCaption,
|
||||
IN UINT uText)
|
||||
_In_opt_ HINSTANCE hInstance,
|
||||
_In_opt_ HWND hwnd,
|
||||
_In_ UINT uType,
|
||||
_In_ UINT uCaption,
|
||||
_In_ UINT uText,
|
||||
...)
|
||||
{
|
||||
WCHAR szCaption[256];
|
||||
WCHAR szText[256];
|
||||
va_list args;
|
||||
WCHAR szCaption[MAX_STR_LENGTH];
|
||||
WCHAR szText[MAX_STR_LENGTH];
|
||||
WCHAR szCookedText[2*MAX_STR_LENGTH];
|
||||
|
||||
LoadStringW(hInstance, uCaption, szCaption, 256);
|
||||
LoadStringW(hInstance, uText, szText, 256);
|
||||
LoadStringW(hInstance, uCaption, szCaption, _countof(szCaption));
|
||||
LoadStringW(hInstance, uText, szText, _countof(szText));
|
||||
|
||||
va_start(args, uText);
|
||||
StringCchVPrintfW(szCookedText, _countof(szCookedText),
|
||||
szText, args);
|
||||
va_end(args);
|
||||
|
||||
return MessageBoxW(hwnd,
|
||||
szText,
|
||||
szCookedText,
|
||||
szCaption,
|
||||
uType);
|
||||
}
|
||||
|
|
|
@ -150,7 +150,6 @@ BOOL
|
|||
DeleteUserProfile(
|
||||
_In_ HWND hwndDlg)
|
||||
{
|
||||
WCHAR szTitle[64], szRawText[128], szCookedText[256];
|
||||
HWND hwndListView;
|
||||
LVITEM Item;
|
||||
INT iSelected;
|
||||
|
@ -179,14 +178,12 @@ DeleteUserProfile(
|
|||
if (pProfileData->dwRefCount != 0)
|
||||
return FALSE;
|
||||
|
||||
LoadStringW(hApplet, IDS_USERPROFILE_CONFIRM_DELETE_TITLE, szTitle, ARRAYSIZE(szTitle));
|
||||
LoadStringW(hApplet, IDS_USERPROFILE_CONFIRM_DELETE, szRawText, ARRAYSIZE(szRawText));
|
||||
swprintf(szCookedText, szRawText, pProfileData->pszFullName);
|
||||
|
||||
if (MessageBoxW(hwndDlg,
|
||||
szCookedText,
|
||||
szTitle,
|
||||
MB_ICONQUESTION | MB_YESNO) == IDYES)
|
||||
if (ResourceMessageBox(hApplet,
|
||||
hwndDlg,
|
||||
MB_ICONQUESTION | MB_YESNO,
|
||||
IDS_USERPROFILE_CONFIRM_DELETE_TITLE,
|
||||
IDS_USERPROFILE_CONFIRM_DELETE,
|
||||
pProfileData->pszFullName) == IDYES)
|
||||
{
|
||||
/* FIXME: Delete the profile here! */
|
||||
return TRUE;
|
||||
|
|
|
@ -12,6 +12,29 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
typedef struct _PAGEFILE
|
||||
{
|
||||
TCHAR szDrive[3];
|
||||
LPTSTR pszVolume;
|
||||
INT OldMinSize;
|
||||
INT OldMaxSize;
|
||||
INT NewMinSize;
|
||||
INT NewMaxSize;
|
||||
UINT FreeSize;
|
||||
BOOL bUsed;
|
||||
} PAGEFILE, *PPAGEFILE;
|
||||
|
||||
typedef struct _VIRTMEM
|
||||
{
|
||||
HWND hSelf;
|
||||
HWND hListBox;
|
||||
LPTSTR szPagingFiles;
|
||||
INT Count;
|
||||
BOOL bModified;
|
||||
PAGEFILE Pagefile[26];
|
||||
} VIRTMEM, *PVIRTMEM;
|
||||
|
||||
|
||||
static BOOL OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem);
|
||||
static LPCTSTR lpKey = _T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
|
||||
|
||||
|
|
Loading…
Reference in a new issue