[ros-diffs] [dchapyshev] 39841: - Get system color depth for application list

dchapyshev at svn.reactos.org dchapyshev at svn.reactos.org
Mon Mar 2 13:46:53 CET 2009


Author: dchapyshev
Date: Mon Mar  2 15:46:53 2009
New Revision: 39841

URL: http://svn.reactos.org/svn/reactos?rev=39841&view=rev
Log:
- Get system color depth for application list

Modified:
    trunk/reactos/base/applications/taskmgr/applpage.c

Modified: trunk/reactos/base/applications/taskmgr/applpage.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/applpage.c?rev=39841&r1=39840&r2=39841&view=diff
==============================================================================
--- trunk/reactos/base/applications/taskmgr/applpage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/applpage.c [iso-8859-1] Mon Mar  2 15:46:53 2009
@@ -58,6 +58,29 @@
 );
 #endif
 
+static INT
+GetSystemColorDepth(VOID)
+{
+    DEVMODE pDevMode;
+    INT ColorDepth;
+
+    pDevMode.dmSize = sizeof(DEVMODE);
+    pDevMode.dmDriverExtra = 0;
+    EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode);
+
+    switch (pDevMode.dmBitsPerPel)
+    {
+        case 32: ColorDepth = ILC_COLOR32; break;
+        case 24: ColorDepth = ILC_COLOR24; break;
+        case 16: ColorDepth = ILC_COLOR16; break;
+        case  8: ColorDepth = ILC_COLOR8;  break;
+        case  4: ColorDepth = ILC_COLOR4;  break;
+        default: ColorDepth = ILC_COLOR;   break;
+    }
+
+    return ColorDepth;
+}
+
 INT_PTR CALLBACK
 ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 {
@@ -101,8 +124,8 @@
         column.cx = 95;
         (void)ListView_InsertColumn(hApplicationPageListCtrl, 1, &column);    /* Add the "Status" column */
 
-        (void)ListView_SetImageList(hApplicationPageListCtrl, ImageList_Create(16, 16, ILC_COLOR8|ILC_MASK, 0, 1), LVSIL_SMALL);
-        (void)ListView_SetImageList(hApplicationPageListCtrl, ImageList_Create(32, 32, ILC_COLOR8|ILC_MASK, 0, 1), LVSIL_NORMAL);
+        (void)ListView_SetImageList(hApplicationPageListCtrl, ImageList_Create(16, 16, GetSystemColorDepth()|ILC_MASK, 0, 1), LVSIL_SMALL);
+        (void)ListView_SetImageList(hApplicationPageListCtrl, ImageList_Create(32, 32, GetSystemColorDepth()|ILC_MASK, 0, 1), LVSIL_NORMAL);
 
         UpdateApplicationListControlViewSetting();
 



More information about the Ros-diffs mailing list