[CPL] Use MAKEINTRESOURCE instead of LoadString (#4631)

Fixes for ACCESS, DESK, INTL, MAIN, MMSYS, OPENGLCFG, POWERCFG, TIMEDATE, USRMGR, and WINED3DCFG.
This commit is contained in:
Thamatip Chitpong 2022-08-27 21:01:55 +07:00 committed by GitHub
parent 730b13daac
commit 0c324e350e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 17 additions and 62 deletions

View file

@ -189,15 +189,12 @@ SystemApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
PGLOBAL_DATA pGlobalData;
PROPSHEETPAGE psp[5];
PROPSHEETHEADER psh;
TCHAR Caption[1024];
INT nPage = 0;
INT ret;
if (uMsg == CPL_STARTWPARMSW && lParam != 0)
nPage = _wtoi((PWSTR)lParam);
LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA));
if (pGlobalData == NULL)
return 0;
@ -214,7 +211,7 @@ SystemApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
psh.hwndParent = hwnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLACCESS);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLSYSTEMNAME);
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;

View file

@ -144,7 +144,6 @@ DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
HPROPSHEETPAGE hpsp[MAX_DESK_PAGES];
PROPSHEETHEADER psh;
HPSXA hpsxa = NULL;
TCHAR Caption[1024];
UINT i;
LPWSTR *argv = NULL;
LPCWSTR pwszSelectedTab = NULL;
@ -198,15 +197,13 @@ DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
g_GlobalData.pwszAction = pwszAction;
g_GlobalData.desktop_color = GetSysColor(COLOR_DESKTOP);
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_USECALLBACK | PSH_PROPTITLE | PSH_USEICONID;
psh.hwndParent = hCPLWindow;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDC_DESK_ICON);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
psh.nPages = 0;
psh.nStartPage = 0;
psh.phpage = hpsp;

View file

@ -1349,9 +1349,6 @@ CustomizeLocalePropertySheet(
{
PROPSHEETPAGEW PsPage[NUM_SHEETS + 1];
PROPSHEETHEADERW psh;
WCHAR Caption[MAX_STR_SIZE];
LoadStringW(hApplet, IDS_CUSTOMIZE_TITLE, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
@ -1359,7 +1356,7 @@ CustomizeLocalePropertySheet(
psh.hwndParent = hwndDlg;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCE(IDC_CPLICON);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCE(IDS_CUSTOMIZE_TITLE);
psh.nPages = (sizeof(PsPage) / sizeof(PROPSHEETPAGE)) - 1;
psh.nStartPage = 0;
psh.ppsp = PsPage;

View file

@ -168,7 +168,6 @@ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
static LONG APIENTRY
Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
{
TCHAR Caption[BUFFERSIZE];
PROPSHEETPAGE psp[3];
PROPSHEETHEADER psh;
PGLOBALDATA pGlobalData;
@ -190,15 +189,13 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
pGlobalData->SystemLCID = GetSystemDefaultLCID();
pGlobalData->bIsUserAdmin = IsUserAdmin();
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
psh.hwndParent = hwnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
psh.nPages = 0;
psh.nStartPage = 0;
psh.ppsp = psp;

View file

@ -305,7 +305,6 @@ KeyboardApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
HPROPSHEETPAGE hpsp[MAX_CPL_PAGES];
PROPSHEETHEADER psh;
HPSXA hpsxa;
TCHAR szCaption[256];
INT nPage = 0;
LONG ret;
@ -317,15 +316,13 @@ KeyboardApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
if (uMsg == CPL_STARTWPARMSW && lParam != 0)
nPage = _wtoi((PWSTR)lParam);
LoadString(hApplet, IDS_CPLNAME_2, szCaption, sizeof(szCaption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
psh.hwndParent = hwnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCE(IDC_CPLICON_2);
psh.pszCaption = szCaption;
psh.pszCaption = MAKEINTRESOURCE(IDS_CPLNAME_2);
psh.nStartPage = 0;
psh.phpage = hpsp;
psh.pfnCallback = PropSheetProc;

View file

@ -1831,7 +1831,6 @@ MouseApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
HPROPSHEETPAGE hpsp[MAX_CPL_PAGES];
PROPSHEETHEADER psh;
HPSXA hpsxa;
TCHAR Caption[256];
UINT i;
INT nPage = 0;
LONG ret;
@ -1844,15 +1843,13 @@ MouseApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
if (uMsg == CPL_STARTWPARMSW && lParam2 != 0)
nPage = _wtoi((PWSTR)lParam2);
LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
psh.hwndParent = hwnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON_1);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME_1);
psh.nStartPage = 0;
psh.phpage = hpsp;
psh.pfnCallback = PropSheetProc;

View file

@ -696,7 +696,6 @@ MmSysApplet(HWND hwnd,
{
PROPSHEETPAGE psp[5];
PROPSHEETHEADER psh; // = { 0 };
TCHAR Caption[256];
INT nPage = 0;
UNREFERENCED_PARAMETER(lParam);
@ -706,14 +705,12 @@ MmSysApplet(HWND hwnd,
if (uMsg == CPL_STARTWPARMSW && lParam != 0)
nPage = _wtoi((PWSTR)lParam);
LoadString(hApplet, IDS_CPLNAME, Caption, _countof(Caption));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
psh.hwndParent = hwnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;
@ -797,18 +794,15 @@ ShowAudioPropertySheet(HWND hwnd,
{
PROPSHEETPAGE psp[1];
PROPSHEETHEADER psh;
TCHAR Caption[256];
DPRINT("ShowAudioPropertySheet()\n");
LoadString(hApplet, IDS_CPLNAME, Caption, _countof(Caption));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
psh.hwndParent = hwnd;
psh.hInstance = hInstance;
psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;
@ -827,18 +821,15 @@ ShowFullControlPanel(HWND hwnd,
{
PROPSHEETPAGE psp[5];
PROPSHEETHEADER psh;
TCHAR Caption[256];
DPRINT("ShowFullControlPanel()\n");
LoadString(hApplet, IDS_CPLNAME, Caption, _countof(Caption));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
psh.hwndParent = hwnd;
psh.hInstance = hInstance;
psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;

View file

@ -308,23 +308,21 @@ SpeakerVolume(
{
PROPSHEETPAGE psp[1];
PROPSHEETHEADER psh;
TCHAR Caption[256];
LoadString(hApplet, IDS_SPEAKER_VOLUME, Caption, _countof(Caption));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE;
psh.hwndParent = hwndDlg;
psh.hInstance = hApplet;
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCE(IDS_SPEAKER_VOLUME);
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;
InitPropSheetPage(&psp[0], IDD_MULTICHANNEL, SpeakerVolumeDlgProc);
psp[0].dwFlags |= PSP_USETITLE;
psp[0].pszTitle = Caption;
psp[0].hInstance = hApplet;
psp[0].pszTitle = MAKEINTRESOURCE(IDS_SPEAKER_VOLUME);
return (LONG)(PropertySheet(&psh) != -1);
}

View file

@ -25,9 +25,6 @@ LONG CALLBACK AppletInit(HWND hWnd)
{
PROPSHEETPAGEW psp;
PROPSHEETHEADERW psh;
WCHAR szCaption[1024];
LoadStringW(hApplet, IDS_CPLNAME, szCaption, sizeof(szCaption) / sizeof(WCHAR));
ZeroMemory(&psp, sizeof(PROPSHEETPAGE));
psp.dwSize = sizeof(PROPSHEETPAGE);
@ -42,7 +39,7 @@ LONG CALLBACK AppletInit(HWND hWnd)
psh.hwndParent = hWnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
psh.pszCaption = szCaption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = &psp;

View file

@ -92,7 +92,6 @@ Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
HPROPSHEETPAGE hpsp[MAX_POWER_PAGES];
PROPSHEETHEADER psh;
HPSXA hpsxa = NULL;
TCHAR Caption[1024];
SYSTEM_POWER_CAPABILITIES spc;
LONG ret;
@ -100,16 +99,13 @@ Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
memset(Caption, 0x0, sizeof(Caption));
LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
psh.hwndParent = hwnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON_1);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME_1);
psh.nPages = 0;
psh.nStartPage = 0;
psh.phpage = hpsp;

View file

@ -89,7 +89,6 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
{
PROPSHEETHEADER psh;
PROPSHEETPAGEW psp[3];
WCHAR Caption[256];
LONG Ret = 0;
UNREFERENCED_PARAMETER(uMsg);
@ -99,15 +98,13 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
if (RegisterMonthCalControl(hApplet) &&
RegisterClockControl())
{
LoadStringW(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(WCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADERW));
psh.dwSize = sizeof(PROPSHEETHEADERW);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
psh.hwndParent = hwnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGEW);
psh.nStartPage = 0;
psh.ppsp = psp;

View file

@ -61,21 +61,18 @@ UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
{
PROPSHEETPAGE psp[2];
PROPSHEETHEADER psh;
TCHAR Caption[1024];
UNREFERENCED_PARAMETER(lParam);
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(uMsg);
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
psh.hwndParent = hwnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDI_USRMGR_ICON);
psh.pszCaption = Caption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = psp;

View file

@ -25,9 +25,6 @@ LONG CALLBACK AppletInit(HWND hWnd)
{
PROPSHEETPAGEW psp;
PROPSHEETHEADERW psh;
WCHAR szCaption[1024];
LoadStringW(hApplet, IDS_CPLNAME, szCaption, sizeof(szCaption) / sizeof(WCHAR));
ZeroMemory(&psp, sizeof(PROPSHEETPAGE));
psp.dwSize = sizeof(PROPSHEETPAGE);
@ -42,7 +39,7 @@ LONG CALLBACK AppletInit(HWND hWnd)
psh.hwndParent = hWnd;
psh.hInstance = hApplet;
psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
psh.pszCaption = szCaption;
psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.ppsp = &psp;