https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bd55105c8a01db4a1d4cbdce59dd9354b3efc410

commit bd55105c8a01db4a1d4cbdce59dd9354b3efc410
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Fri Dec 14 20:06:57 2018 +0900
Commit:     GitHub <nore...@github.com>
CommitDate: Fri Dec 14 20:06:57 2018 +0900

    [CPL] Properly set display icons of control panel applets (#1129)
    
    CORE-15445
---
 dll/cpl/access/access.c         | 21 +++++++++++++++++++--
 dll/cpl/appwiz/createlink.c     | 21 ++++++++++++++++++++-
 dll/cpl/console/console.c       | 20 +++++++++++++++++++-
 dll/cpl/desk/desk.c             | 22 ++++++++++++++++++++--
 dll/cpl/hdwwiz/hdwwiz.c         | 21 ++++++++++++++++++++-
 dll/cpl/inetcpl/inetcpl.c       |  8 ++++++--
 dll/cpl/input/input.c           | 22 +++++++++++++++++++---
 dll/cpl/intl/generalp.c         | 21 +++++++++++++++++++--
 dll/cpl/intl/intl.c             | 22 ++++++++++++++++++++--
 dll/cpl/main/keyboard.c         | 21 +++++++++++++++++++--
 dll/cpl/main/mouse.c            | 22 ++++++++++++++++++++--
 dll/cpl/mmsys/mmsys.c           | 23 ++++++++++++++++++++---
 dll/cpl/openglcfg/openglcfg.c   | 22 ++++++++++++++++++++--
 dll/cpl/powercfg/powercfg.c     | 21 +++++++++++++++++++--
 dll/cpl/sysdm/sysdm.c           | 23 ++++++++++++++++++++---
 dll/cpl/timedate/timedate.c     | 21 +++++++++++++++++++--
 dll/cpl/usrmgr/usrmgr.c         | 21 +++++++++++++++++++--
 dll/cpl/wined3dcfg/wined3dcfg.c | 22 ++++++++++++++++++++--
 18 files changed, 338 insertions(+), 36 deletions(-)

diff --git a/dll/cpl/access/access.c b/dll/cpl/access/access.c
index 9bd028c64f..86a1f06907 100644
--- a/dll/cpl/access/access.c
+++ b/dll/cpl/access/access.c
@@ -165,6 +165,22 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC 
DlgProc, PGLOBAL_DATA
     psp->lParam = (LPARAM)pGlobalData;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLACCESS));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
 
 /* First Applet */
 
@@ -191,14 +207,15 @@ SystemApplet(VOID)
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags =  PSH_PROPSHEETPAGE;
+    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
     psh.hwndParent = hCPLWindow;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLACCESS));
+    psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLACCESS);
     psh.pszCaption = Caption;
     psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
     psh.nStartPage = 0;
     psh.ppsp = psp;
+    psh.pfnCallback = PropSheetProc;
 
     InitPropSheetPage(&psp[0], IDD_PROPPAGEKEYBOARD, KeyboardPageProc, 
pGlobalData);
     InitPropSheetPage(&psp[1], IDD_PROPPAGESOUND, SoundPageProc, pGlobalData);
diff --git a/dll/cpl/appwiz/createlink.c b/dll/cpl/appwiz/createlink.c
index 4788cc878b..c3a3c1055c 100644
--- a/dll/cpl/appwiz/createlink.c
+++ b/dll/cpl/appwiz/createlink.c
@@ -381,6 +381,23 @@ FinishDlgProc(HWND hwndDlg,
     return FALSE;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_APPINETICO));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 LONG CALLBACK
 ShowCreateShortcutWizard(HWND hwndCPl, LPWSTR szPath)
 {
@@ -447,13 +464,15 @@ ShowCreateShortcutWizard(HWND hwndCPl, LPWSTR szPath)
 
     /* Create the property sheet */
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK;
+    psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_USEICONID | 
PSH_USECALLBACK;
     psh.hInstance = hApplet;
+    psh.pszIcon = MAKEINTRESOURCEW(IDI_APPINETICO);
     psh.hwndParent = NULL;
     psh.nPages = nPages;
     psh.nStartPage = 0;
     psh.phpage = ahpsp;
     psh.pszbmWatermark = MAKEINTRESOURCEW(IDB_SHORTCUT);
+    psh.pfnCallback = PropSheetProc;
 
     /* Display the wizard */
     PropertySheet(&psh);
diff --git a/dll/cpl/console/console.c b/dll/cpl/console/console.c
index d2cd2d7caa..d39253a0c6 100644
--- a/dll/cpl/console/console.c
+++ b/dll/cpl/console/console.c
@@ -133,6 +133,23 @@ Done:
     return;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDC_CPLICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 /* First Applet */
 static LONG
 APIENTRY
@@ -218,7 +235,7 @@ InitApplet(HANDLE hSectionOrWnd)
     /* Initialize the property sheet structure */
     ZeroMemory(&psh, sizeof(psh));
     psh.dwSize = sizeof(psh);
-    psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | /* PSH_USEHICON */ 
PSH_USEICONID | PSH_NOAPPLYNOW;
+    psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | /* PSH_USEHICON */ 
PSH_USEICONID | PSH_NOAPPLYNOW | PSH_USECALLBACK;
 
     if (ConInfo->ConsoleTitle[0] != UNICODE_NULL)
     {
@@ -249,6 +266,7 @@ InitApplet(HANDLE hSectionOrWnd)
     psh.nPages = ARRAYSIZE(psp);
     psh.nStartPage = 0;
     psh.ppsp = psp;
+    psh.pfnCallback = PropSheetProc;
 
     InitPropSheetPage(&psp[i++], IDD_PROPPAGEOPTIONS, OptionsProc);
     InitPropSheetPage(&psp[i++], IDD_PROPPAGEFONT   , FontProc   );
diff --git a/dll/cpl/desk/desk.c b/dll/cpl/desk/desk.c
index 2cf27a7026..0277e7f264 100644
--- a/dll/cpl/desk/desk.c
+++ b/dll/cpl/desk/desk.c
@@ -118,6 +118,23 @@ static const struct
     { IDD_SETTINGS, SettingsPageProc, SettingsPageCallbackProc, L"Settings" },
 };
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDC_DESK_ICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 /* Display Applet */
 static LONG APIENTRY
 DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
@@ -180,14 +197,15 @@ DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM 
lParam)
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags = PSH_USECALLBACK | PSH_PROPTITLE;
+    psh.dwFlags = PSH_USECALLBACK | PSH_PROPTITLE | PSH_USEICONID;
     psh.hwndParent = hCPLWindow;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_DESK_ICON));
+    psh.pszIcon = MAKEINTRESOURCEW(IDC_DESK_ICON);
     psh.pszCaption = Caption;
     psh.nPages = 0;
     psh.nStartPage = 0;
     psh.phpage = hpsp;
+    psh.pfnCallback = PropSheetProc;
 
     /* Allow shell extensions to replace the background page */
     hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, 
REGSTR_PATH_CONTROLSFOLDER TEXT("\\Desk"), MAX_DESK_PAGES - psh.nPages);
diff --git a/dll/cpl/hdwwiz/hdwwiz.c b/dll/cpl/hdwwiz/hdwwiz.c
index 5038b1c57e..0b1daccf34 100644
--- a/dll/cpl/hdwwiz/hdwwiz.c
+++ b/dll/cpl/hdwwiz/hdwwiz.c
@@ -776,6 +776,23 @@ ProgressPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM 
wParam, LPARAM lParam)
     return FALSE;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 static VOID
 HardwareWizardInit(HWND hwnd)
 {
@@ -888,14 +905,16 @@ HardwareWizardInit(HWND hwnd)
 
     /* Create the property sheet */
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
+    psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER | PSH_USEICONID | 
PSH_USECALLBACK;
     psh.hInstance = hApplet;
+    psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
     psh.hwndParent = hwnd;
     psh.nPages = nPages;
     psh.nStartPage = 0;
     psh.phpage = ahpsp;
     psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
     psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
+    psh.pfnCallback = PropSheetProc;
 
     /* Create title font */
     hTitleFont = CreateTitleFont();
diff --git a/dll/cpl/inetcpl/inetcpl.c b/dll/cpl/inetcpl/inetcpl.c
index 9f220164db..b4d5a14037 100644
--- a/dll/cpl/inetcpl/inetcpl.c
+++ b/dll/cpl/inetcpl/inetcpl.c
@@ -77,13 +77,17 @@ HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
  */
 static int CALLBACK propsheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
 {
-
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
     TRACE("(%p, 0x%08x/%d, 0x%lx)\n", hwnd, msg, msg, lparam);
     switch (msg)
     {
         case PSCB_INITIALIZED:
-            SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) LoadIconW(hcpl, 
MAKEINTRESOURCEW(ICO_MAIN)));
+        {
+            hIcon = LoadIconW(hcpl, MAKEINTRESOURCEW(ICO_MAIN));
+            SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
             break;
+        }
     }
     return 0;
 }
diff --git a/dll/cpl/input/input.c b/dll/cpl/input/input.c
index d794dc830f..c9788769dc 100644
--- a/dll/cpl/input/input.c
+++ b/dll/cpl/input/input.c
@@ -38,6 +38,22 @@ InitPropSheetPage(PROPSHEETPAGEW *page, WORD idDlg, DLGPROC 
DlgProc)
     page->pfnDlgProc  = DlgProc;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLSYSTEM));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
 
 /* First Applet */
 static LONG CALLBACK
@@ -52,15 +68,15 @@ SystemApplet(VOID)
     ZeroMemory(&header, sizeof(header));
 
     header.dwSize      = sizeof(header);
-    header.dwFlags     = PSH_PROPSHEETPAGE;
+    header.dwFlags     = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
     header.hwndParent  = hCPLWindow;
     header.hInstance   = hApplet;
-    header.hIcon       = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLSYSTEM));
+    header.pszIcon     = MAKEINTRESOURCEW(IDI_CPLSYSTEM);
     header.pszCaption  = szCaption;
     header.nPages      = ARRAYSIZE(page);
     header.nStartPage  = 0;
     header.ppsp        = page;
-    header.pfnCallback = NULL;
+    header.pfnCallback = PropSheetProc;
 
     /* Settings */
     InitPropSheetPage(&page[0], IDD_PROPPAGESETTINGS, SettingsPageProc);
diff --git a/dll/cpl/intl/generalp.c b/dll/cpl/intl/generalp.c
index bee911bc8b..8055e89edd 100644
--- a/dll/cpl/intl/generalp.c
+++ b/dll/cpl/intl/generalp.c
@@ -1324,6 +1324,22 @@ InitPropSheetPage(
     psp->lParam = (LPARAM)pGlobalData;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDC_CPLICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
 
 INT_PTR
 APIENTRY
@@ -1339,14 +1355,15 @@ CustomizeLocalePropertySheet(
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_USECALLBACK;
+    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
     psh.hwndParent = hwndDlg;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
+    psh.pszIcon = MAKEINTRESOURCE(IDC_CPLICON);
     psh.pszCaption = Caption;
     psh.nPages = (sizeof(PsPage) / sizeof(PROPSHEETPAGE)) - 1;
     psh.nStartPage = 0;
     psh.ppsp = PsPage;
+    psh.pfnCallback = PropSheetProc;
 
     InitPropSheetPage(&PsPage[0], IDD_NUMBERSPAGE, NumbersPageProc, 
pGlobalData);
     InitPropSheetPage(&PsPage[1], IDD_CURRENCYPAGE, CurrencyPageProc, 
pGlobalData);
diff --git a/dll/cpl/intl/intl.c b/dll/cpl/intl/intl.c
index 440e34469a..13ec00906a 100644
--- a/dll/cpl/intl/intl.c
+++ b/dll/cpl/intl/intl.c
@@ -149,6 +149,23 @@ ParseSetupInf(VOID)
     SetupCloseInfFile(hSetupInf);
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDC_CPLICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 static LONG APIENTRY
 Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
 {
@@ -174,14 +191,15 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags =  PSH_PROPSHEETPAGE;
+    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
     psh.hwndParent = hCPLWindow;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
+    psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON);
     psh.pszCaption = Caption;
     psh.nPages = 0; //sizeof(psp) / sizeof(PROPSHEETPAGE);
     psh.nStartPage = 0;
     psh.ppsp = psp;
+    psh.pfnCallback = PropSheetProc;
 
     InitIntlPropSheetPage(&psp[0], IDD_GENERALPAGE, GeneralPageProc, 
(LPARAM)pGlobalData);
     psh.nPages++;
diff --git a/dll/cpl/main/keyboard.c b/dll/cpl/main/keyboard.c
index 165d66824f..5cf39b89bc 100644
--- a/dll/cpl/main/keyboard.c
+++ b/dll/cpl/main/keyboard.c
@@ -282,6 +282,22 @@ KeybHardwareProc(IN HWND hwndDlg,
     return FALSE;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDC_CPLICON_2));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
 
 LONG APIENTRY
 KeyboardApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
@@ -301,13 +317,14 @@ KeyboardApplet(HWND hwnd, UINT uMsg, LPARAM wParam, 
LPARAM lParam)
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags =  PSH_PROPTITLE;
+    psh.dwFlags =  PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
     psh.hwndParent = hwnd;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON_2));
+    psh.pszIcon = MAKEINTRESOURCE(IDC_CPLICON_2);
     psh.pszCaption = szCaption;
     psh.nStartPage = 0;
     psh.phpage = hpsp;
+    psh.pfnCallback = PropSheetProc;
 
     /* Load additional pages provided by shell extensions */
     hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, 
REGSTR_PATH_CONTROLSFOLDER TEXT("\\Keyboard"), MAX_CPL_PAGES - psh.nPages);
diff --git a/dll/cpl/main/mouse.c b/dll/cpl/main/mouse.c
index a17d1795ed..4614e6ebc1 100644
--- a/dll/cpl/main/mouse.c
+++ b/dll/cpl/main/mouse.c
@@ -1794,6 +1794,23 @@ WheelProc(IN HWND hwndDlg,
     return FALSE;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDC_CPLICON_1));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 static const struct
 {
     WORD idDlg;
@@ -1827,13 +1844,14 @@ MouseApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, 
LPARAM lParam2)
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags = PSH_PROPTITLE;
+    psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
     psh.hwndParent = hwnd;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON_1));
+    psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON_1);
     psh.pszCaption = Caption;
     psh.nStartPage = 0;
     psh.phpage = hpsp;
+    psh.pfnCallback = PropSheetProc;
 
     /* Load additional pages provided by shell extensions */
     hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, 
REGSTR_PATH_CONTROLSFOLDER TEXT("\\Mouse"), MAX_CPL_PAGES - psh.nPages);
diff --git a/dll/cpl/mmsys/mmsys.c b/dll/cpl/mmsys/mmsys.c
index e2e21bc8dd..e2d7c8e539 100644
--- a/dll/cpl/mmsys/mmsys.c
+++ b/dll/cpl/mmsys/mmsys.c
@@ -689,6 +689,23 @@ HardwareDlgProc(HWND hwndDlg,
     return FALSE;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 LONG APIENTRY
 MmSysApplet(HWND hwnd,
             UINT uMsg,
@@ -706,15 +723,15 @@ MmSysApplet(HWND hwnd,
     LoadString(hApplet, IDS_CPLNAME, Caption, _countof(Caption));
 
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_PROPTITLE;
+    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | 
PSH_USECALLBACK;
     psh.hwndParent = hwnd;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet,
-                         MAKEINTRESOURCE(IDI_CPLICON));
+    psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
     psh.pszCaption = Caption;
     psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
     psh.nStartPage = 0;
     psh.ppsp = psp;
+    psh.pfnCallback = PropSheetProc;
 
     InitPropSheetPage(&psp[0], IDD_VOLUME,VolumeDlgProc);
     InitPropSheetPage(&psp[1], IDD_SOUNDS,SoundsDlgProc);
diff --git a/dll/cpl/openglcfg/openglcfg.c b/dll/cpl/openglcfg/openglcfg.c
index 8a142fdf40..281d1b23ec 100644
--- a/dll/cpl/openglcfg/openglcfg.c
+++ b/dll/cpl/openglcfg/openglcfg.c
@@ -4,6 +4,23 @@
 
 HINSTANCE hApplet = 0;
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 LONG CALLBACK AppletInit(HWND hWnd)
 {
     PROPSHEETPAGEW psp;
@@ -21,14 +38,15 @@ LONG CALLBACK AppletInit(HWND hWnd)
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags =  PSH_PROPSHEETPAGE;
+    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
     psh.hwndParent = hWnd;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLICON));
+    psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
     psh.pszCaption = szCaption;
     psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
     psh.nStartPage = 0;
     psh.ppsp = &psp;
+    psh.pfnCallback = PropSheetProc;
 
     return (LONG)(PropertySheet(&psh) != -1);
 }
diff --git a/dll/cpl/powercfg/powercfg.c b/dll/cpl/powercfg/powercfg.c
index fd820cc6d2..61a910cabf 100644
--- a/dll/cpl/powercfg/powercfg.c
+++ b/dll/cpl/powercfg/powercfg.c
@@ -67,6 +67,22 @@ InitPropSheetPage(PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC 
DlgProc)
     return FALSE;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDC_CPLICON_1));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
 
 /* First Applet */
 static LONG APIENTRY
@@ -88,14 +104,15 @@ Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
 
   ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
   psh.dwSize = sizeof(PROPSHEETHEADER);
-  psh.dwFlags = PSH_PROPTITLE;
+  psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
   psh.hwndParent = hwnd;
   psh.hInstance = hApplet;
-  psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON_1));
+  psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON_1);
   psh.pszCaption = Caption;
   psh.nPages = 0;
   psh.nStartPage = 0;
   psh.phpage = hpsp;
+  psh.pfnCallback = PropSheetProc;
 
   InitPropSheetPage(&psh, IDD_PROPPAGEPOWERSCHEMES, PowerSchemesDlgProc);
   if (GetPwrCapabilities(&spc))
diff --git a/dll/cpl/sysdm/sysdm.c b/dll/cpl/sysdm/sysdm.c
index 36bd5f5114..8ce26a2a44 100644
--- a/dll/cpl/sysdm/sysdm.c
+++ b/dll/cpl/sysdm/sysdm.c
@@ -121,6 +121,23 @@ Fail:
     return hMod;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLSYSTEM));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 /* First Applet */
 LONG CALLBACK
 SystemApplet(VOID)
@@ -137,15 +154,15 @@ SystemApplet(VOID)
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags =  PSH_PROPTITLE;
+    psh.dwFlags =  PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
     psh.hwndParent = hCPLWindow;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
+    psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLSYSTEM);
     psh.pszCaption = MAKEINTRESOURCE(IDS_CPLSYSTEMNAME);
     psh.nPages = 0;
     psh.nStartPage = 0;
     psh.phpage = hpsp;
-    psh.pfnCallback = NULL;
+    psh.pfnCallback = PropSheetProc;
 
     InitPropSheetPage(&psh, IDD_PROPPAGEGENERAL, GeneralPageProc);
     hNetIdDll = AddNetIdPage(&psh);
diff --git a/dll/cpl/timedate/timedate.c b/dll/cpl/timedate/timedate.c
index 3bf0d7e57d..52a03f41fe 100644
--- a/dll/cpl/timedate/timedate.c
+++ b/dll/cpl/timedate/timedate.c
@@ -67,6 +67,22 @@ InitPropSheetPage(PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC 
DlgProc)
     psp->pfnDlgProc = DlgProc;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDC_CPLICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
 
 static LONG APIENTRY
 Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
@@ -87,14 +103,15 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
 
         ZeroMemory(&psh, sizeof(PROPSHEETHEADERW));
         psh.dwSize = sizeof(PROPSHEETHEADERW);
-        psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_PROPTITLE;
+        psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | 
PSH_USECALLBACK;
         psh.hwndParent = hwnd;
         psh.hInstance = hApplet;
-        psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCEW(IDC_CPLICON));
+        psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON);
         psh.pszCaption = Caption;
         psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGEW);
         psh.nStartPage = 0;
         psh.ppsp = psp;
+        psh.pfnCallback = PropSheetProc;
 
         InitPropSheetPage(&psp[0], IDD_DATETIMEPAGE, DateTimePageProc);
         InitPropSheetPage(&psp[1], IDD_TIMEZONEPAGE, TimeZonePageProc);
diff --git a/dll/cpl/usrmgr/usrmgr.c b/dll/cpl/usrmgr/usrmgr.c
index dd3bbbb470..508e6594e4 100644
--- a/dll/cpl/usrmgr/usrmgr.c
+++ b/dll/cpl/usrmgr/usrmgr.c
@@ -38,6 +38,22 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC 
DlgProc)
     psp->pfnDlgProc = DlgProc;
 }
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_USRMGR_ICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
 
 /* Display Applet */
 static LONG APIENTRY
@@ -55,14 +71,15 @@ UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM 
lParam)
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags =  PSH_PROPSHEETPAGE;
+    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
     psh.hwndParent = hwnd;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_USRMGR_ICON));
+    psh.pszIcon = MAKEINTRESOURCEW(IDI_USRMGR_ICON);
     psh.pszCaption = Caption;
     psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
     psh.nStartPage = 0;
     psh.ppsp = psp;
+    psh.pfnCallback = PropSheetProc;
 
     InitPropSheetPage(&psp[0], IDD_USERS, UsersPageProc);
     InitPropSheetPage(&psp[1], IDD_GROUPS, GroupsPageProc);
diff --git a/dll/cpl/wined3dcfg/wined3dcfg.c b/dll/cpl/wined3dcfg/wined3dcfg.c
index 7740d6c119..8046bb2a3e 100644
--- a/dll/cpl/wined3dcfg/wined3dcfg.c
+++ b/dll/cpl/wined3dcfg/wined3dcfg.c
@@ -4,6 +4,23 @@
 
 HINSTANCE hApplet = 0;
 
+static int CALLBACK
+PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
+{
+    // NOTE: This callback is needed to set large icon correctly.
+    HICON hIcon;
+    switch (uMsg)
+    {
+        case PSCB_INITIALIZED:
+        {
+            hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLICON));
+            SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+            break;
+        }
+    }
+    return 0;
+}
+
 LONG CALLBACK AppletInit(HWND hWnd)
 {
     PROPSHEETPAGEW psp;
@@ -21,14 +38,15 @@ LONG CALLBACK AppletInit(HWND hWnd)
 
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags =  PSH_PROPSHEETPAGE;
+    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
     psh.hwndParent = hWnd;
     psh.hInstance = hApplet;
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLICON));
+    psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
     psh.pszCaption = szCaption;
     psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
     psh.nStartPage = 0;
     psh.ppsp = &psp;
+    psh.pfnCallback = PropSheetProc;
 
     return (LONG)(PropertySheet(&psh) != -1);
 }

Reply via email to