Author: dchapyshev
Date: Wed Oct 8 11:01:41 2008
New Revision: 36697
URL:
http://svn.reactos.org/svn/reactos?rev=36697&view=rev
Log:
- Add getting icon metrics
- Change icons sizes at change of system settings
Modified:
trunk/reactos/base/applications/msconfig/msconfig.c
Modified: trunk/reactos/base/applications/msconfig/msconfig.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig/msconfig.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig/msconfig.c [iso-8859-1] Wed Oct 8 11:01:41
2008
@@ -12,6 +12,8 @@
HWND hMainWnd; /* Main Window */
HWND hTabWnd; /* Tab Control Window */
+UINT uXIcon = 0, uYIcon = 0; /* Icon sizes */
+HICON hDialogIcon = NULL;
void MsConfig_OnTabWndSelChange(void);
@@ -94,7 +96,7 @@
ShowWindow(hFreeLdrPage, SW_HIDE);
ShowWindow(hServicesPage, SW_HIDE);
BringWindowToTop(hSystemPage);
- break;
+ break;
case 2: //Freeldr
ShowWindow(hGeneralPage, SW_HIDE);
ShowWindow(hSystemPage, SW_HIDE);
@@ -132,6 +134,25 @@
BringWindowToTop(hToolsPage);
break;
}
+}
+
+
+static
+VOID
+SetDialogIcon(HWND hDlg)
+{
+ if (hDialogIcon) DestroyIcon(hDialogIcon);
+
+ hDialogIcon = LoadImage(GetModuleHandle(NULL),
+ MAKEINTRESOURCE(IDI_APPICON),
+ IMAGE_ICON,
+ uXIcon,
+ uYIcon,
+ 0);
+ SendMessage(hDlg,
+ WM_SETICON,
+ ICON_SMALL,
+ (LPARAM)hDialogIcon);
}
@@ -141,23 +162,31 @@
{
int idctrl;
LPNMHDR pnmh;
- static HICON hIcon;
+ UINT uXIconNew, uYIconNew;
switch (message)
{
case WM_INITDIALOG:
hMainWnd = hDlg;
- hIcon = LoadImage(GetModuleHandle(NULL),
- MAKEINTRESOURCE(IDI_APPICON),
- IMAGE_ICON,
- 16,
- 16,
- 0);
- SendMessage(hDlg,
- WM_SETICON,
- ICON_SMALL,
- (LPARAM)hIcon);
+
+ uXIcon = GetSystemMetrics(SM_CXSMICON);
+ uYIcon = GetSystemMetrics(SM_CYSMICON);
+
+ SetDialogIcon(hDlg);
+
return OnCreate(hDlg);
+
+ case WM_SETTINGCHANGE:
+ uXIconNew = GetSystemMetrics(SM_CXSMICON);
+ uYIconNew = GetSystemMetrics(SM_CYSMICON);
+
+ if ((uXIcon != uXIconNew) || (uYIcon != uYIconNew))
+ {
+ uXIcon = uXIconNew;
+ uYIcon = uYIconNew;
+ SetDialogIcon(hDlg);
+ }
+ break;
case WM_COMMAND:
@@ -196,8 +225,8 @@
DestroyWindow(hFreeLdrPage);
if (hSystemPage)
DestroyWindow(hSystemPage);
- if (hIcon)
- DestroyIcon(hIcon);
+ if (hDialogIcon)
+ DestroyIcon(hDialogIcon);
return DefWindowProc(hDlg, message, wParam, lParam);
}