[ros-diffs] [cfinck] 33508: Open the Explorer Shell Folder instead of providing a standalone Control Panel. This changed enables us to remove lots of files from the app :-)

cfinck at svn.reactos.org cfinck at svn.reactos.org
Tue May 13 23:39:26 CEST 2008


Author: cfinck
Date: Tue May 13 16:39:25 2008
New Revision: 33508

URL: http://svn.reactos.org/svn/reactos?rev=33508&view=rev
Log:
Open the Explorer Shell Folder instead of providing a standalone Control Panel.
This changed enables us to remove lots of files from the app :-)

Removed:
    trunk/reactos/base/applications/control/lang/
    trunk/reactos/base/applications/control/rsrc.rc
Modified:
    trunk/reactos/base/applications/control/control.c
    trunk/reactos/base/applications/control/control.h
    trunk/reactos/base/applications/control/control.rbuild
    trunk/reactos/base/applications/control/control.rc
    trunk/reactos/base/applications/control/resource.h

Modified: trunk/reactos/base/applications/control/control.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/control.c?rev=33508&r1=33507&r2=33508&view=diff
==============================================================================
--- trunk/reactos/base/applications/control/control.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/control/control.c [iso-8859-1] Tue May 13 16:39:25 2008
@@ -37,298 +37,6 @@
     return RUNDLL(szParameters);
 }
 
-static VOID
-PopulateCPLList(HWND hLisCtrl)
-{
-    WIN32_FIND_DATA fd;
-    HANDLE hFind;
-    TCHAR pszSearchPath[MAX_PATH];
-    HIMAGELIST hImgListSmall;
-    HIMAGELIST hImgListLarge;
-    HMODULE hDll;
-    CPLAPPLETFUNC pFunc;
-    TCHAR pszPath[MAX_PATH];
-    TCHAR szPanelNum[CCH_UINT_MAX + 1];
-    DEVMODE pDevMode;
-
-    /* Icon drawing mode */
-    pDevMode.dmSize = sizeof(DEVMODE);
-    pDevMode.dmDriverExtra = 0;
-
-    EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode);
-    hImgListSmall = ImageList_Create(16, 16, pDevMode.dmBitsPerPel | ILC_MASK, 5, 5);
-    hImgListLarge = ImageList_Create(32, 32, pDevMode.dmBitsPerPel | ILC_MASK, 5, 5);
-
-    GetSystemDirectory(pszSearchPath, MAX_PATH);
-    _tcscat(pszSearchPath, _T("\\*.cpl"));
-
-    hFind = FindFirstFile(pszSearchPath, &fd);
-
-    while (hFind != INVALID_HANDLE_VALUE)
-    {
-        _tcscpy(pszPath, pszSearchPath);
-        *_tcsrchr(pszPath, '\\') = 0;
-        _tcscat(pszPath, _T("\\"));
-        _tcscat(pszPath, fd.cFileName);
-
-        hDll = LoadLibrary(pszPath);
-        pFunc = (CPLAPPLETFUNC)GetProcAddress(hDll, "CPlApplet");
-
-        if (pFunc && pFunc(hLisCtrl, CPL_INIT, 0, 0))
-        {
-            UINT i, uPanelCount;
-
-            uPanelCount = (UINT)pFunc(hLisCtrl, CPL_GETCOUNT, 0, 0);
-
-            for (i = 0; i < uPanelCount; i++)
-            {
-                CPLINFO CplInfo;
-                HICON hIcon;
-                TCHAR Name[MAX_PATH];
-                int index;
-                LPTSTR pszCmd;
-
-                pszCmd = (LPTSTR) HeapAlloc(hProcessHeap, 0, MAX_PATH * sizeof(TCHAR));
-                if(!pszCmd)
-                    return;
-
-                /* Build the command, which is later passed to RunControlPanel */
-                _tcscpy(pszCmd, fd.cFileName);
-                _tcscat(pszCmd, _T(" @"));
-                _itot(i, szPanelNum, 10);
-                _tcscat(pszCmd, szPanelNum);
-
-                pFunc(hLisCtrl, CPL_INQUIRE, (LPARAM)i, (LPARAM)&CplInfo);
-
-                hIcon = LoadImage(hDll, MAKEINTRESOURCE(CplInfo.idIcon), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
-                index = ImageList_AddIcon(hImgListSmall, hIcon);
-                DestroyIcon(hIcon);
-
-                hIcon = LoadImage(hDll, MAKEINTRESOURCE(CplInfo.idIcon), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
-                ImageList_AddIcon(hImgListLarge, hIcon);
-                DestroyIcon(hIcon);
-
-                if (LoadString(hDll, CplInfo.idName, Name, MAX_PATH))
-                {
-                    INT nIndex;
-                    LV_ITEM lvi = {0};
-
-                    lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
-                    lvi.pszText = Name;
-                    lvi.state = 0;
-                    lvi.iImage = index;
-                    lvi.lParam = (LPARAM)pszCmd;
-                    nIndex = ListView_InsertItem(hLisCtrl, &lvi);
-
-                    if (LoadString(hDll, CplInfo.idInfo, Name, MAX_PATH))
-                        ListView_SetItemText(hLisCtrl, nIndex, 1, Name);
-                }
-            }
-        }
-
-        if (!FindNextFile(hFind, &fd))
-            hFind = INVALID_HANDLE_VALUE;
-    }
-
-    (void)ListView_SetImageList(hLisCtrl, hImgListSmall, LVSIL_SMALL);
-    (void)ListView_SetImageList(hLisCtrl, hImgListLarge, LVSIL_NORMAL);
-}
-
-LRESULT CALLBACK
-MyWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-    static HWND hListView;
-    TCHAR szBuf[1024];
-
-    switch (uMsg)
-    {
-        case WM_CREATE:
-        {
-            RECT rect;
-            LV_COLUMN column = {0};
-
-            GetClientRect(hWnd, &rect);
-            hListView = CreateWindow(WC_LISTVIEW, NULL, LVS_REPORT | LVS_ALIGNLEFT | LVS_SORTASCENDING | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, rect.right, rect.bottom, hWnd, NULL, hInst, 0);
-
-            column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;
-            column.fmt = LVCFMT_LEFT;
-            column.cx = (rect.right - rect.left) / 3;
-            column.iSubItem = 0;
-            LoadString(hInst, IDS_NAME, szBuf, sizeof(szBuf) / sizeof(TCHAR));
-            column.pszText = szBuf;
-            (void)ListView_InsertColumn(hListView, 0, &column);
-
-            column.cx = (rect.right - rect.left) - ((rect.right - rect.left) / 3) - 1;
-            column.iSubItem = 1;
-            LoadString(hInst, IDS_COMMENT, szBuf, sizeof(szBuf) / sizeof(TCHAR));
-            column.pszText = szBuf;
-            (void)ListView_InsertColumn(hListView, 1, &column);
-
-            PopulateCPLList(hListView);
-
-            (void)ListView_SetColumnWidth(hListView, 2, LVSCW_AUTOSIZE_USEHEADER);
-            (void)ListView_Update(hListView, 0);
-
-            SetFocus(hListView);
-
-            return 0;
-        }
-
-        case WM_DESTROY:
-        {
-            LV_ITEM lvi;
-            INT nItems;
-
-            lvi.mask = LVIF_PARAM;
-
-            /* Free the memory used for the command strings */
-            for(nItems = ListView_GetItemCount(hListView); --nItems >= 0;)
-            {
-                lvi.iItem = nItems;
-                (void)ListView_GetItem(hListView, &lvi);
-                HeapFree(hProcessHeap, 0, (LPVOID)lvi.lParam);
-            }
-
-            PostQuitMessage(0);
-            return 0;
-        }
-
-        case WM_SIZE:
-        {
-            RECT rect;
-
-            GetClientRect(hWnd, &rect);
-            MoveWindow(hListView, 0, 0, rect.right, rect.bottom, TRUE);
-
-            return 0;
-        }
-
-        case WM_NOTIFY:
-        {
-            NMHDR *phdr;
-            phdr = (NMHDR*)lParam;
-
-            switch(phdr->code)
-            {
-                case NM_RETURN:
-                case NM_DBLCLK:
-                {
-                    int nSelect;
-                    LV_ITEM lvi = {0};
-                    LPTSTR pszCmd;
-
-                    nSelect = SendMessage(hListView, LVM_GETNEXTITEM, (WPARAM)-1, LVNI_FOCUSED);
-
-                    if (nSelect == -1)
-                    {
-                        /* no items */
-                        LoadString(hInst, IDS_NO_ITEMS, szBuf, sizeof(szBuf) / sizeof(TCHAR));
-                        MessageBox(hWnd, (LPCTSTR)szBuf, NULL, MB_OK | MB_ICONINFORMATION);
-                        break;
-                    }
-
-                    lvi.iItem = nSelect;
-                    lvi.mask = LVIF_PARAM;
-                    (void)ListView_GetItem(hListView, &lvi);
-
-                    pszCmd = (LPTSTR)lvi.lParam;
-
-                    if (pszCmd)
-                        RunControlPanel(pszCmd);
-
-                    return 0;
-                }
-            }
-        }
-
-        case WM_COMMAND:
-            switch (LOWORD(wParam))
-            {
-                case IDM_LARGEICONS:
-                    SetWindowLong(hListView,GWL_STYLE,LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL   | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP);
-                    return 0;
-
-                case IDM_SMALLICONS:
-                    SetWindowLong(hListView,GWL_STYLE,LVS_SMALLICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL   | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP);
-                    return 0;
-
-                case IDM_LIST:
-                    SetWindowLong(hListView,GWL_STYLE,LVS_LIST | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL   | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP);
-                    return 0;
-
-                case IDM_DETAILS:
-                    SetWindowLong(hListView,GWL_STYLE,LVS_REPORT | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL   | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP);
-                    return 0;
-
-                case IDM_CLOSE:
-                    DestroyWindow(hWnd);
-                    return 0;
-
-                case IDM_ABOUT:
-                {
-                    TCHAR Title[256];
-
-                    LoadString(hInst, IDS_ABOUT, szBuf, sizeof(szBuf) / sizeof(TCHAR));
-                    LoadString(hInst, IDS_ABOUT_TITLE, Title, sizeof(Title) / sizeof(TCHAR));
-
-                    MessageBox(hWnd, (LPCTSTR)szBuf, (LPCTSTR)Title, MB_OK | MB_ICONINFORMATION);
-
-                    return 0;
-                }
-            }
-    }
-
-    return DefWindowProc(hWnd, uMsg, wParam, lParam);
-}
-
-
-static INT
-RunControlPanelWindow(int nCmdShow)
-{
-    MSG msg;
-    HWND hMainWnd;
-    INITCOMMONCONTROLSEX icex;
-    WNDCLASSEX wcex = {0};
-    TCHAR szBuf[256];
-
-    wcex.cbSize = sizeof(wcex);
-    wcex.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAINICON));
-    wcex.lpszClassName = MYWNDCLASS;
-    wcex.lpfnWndProc = MyWindowProc;
-    RegisterClassEx(&wcex);
-
-    icex.dwSize = sizeof(icex);
-    icex.dwICC = ICC_LISTVIEW_CLASSES;
-    InitCommonControlsEx(&icex);
-
-    LoadString(hInst, IDS_WINDOW_TITLE, szBuf, sizeof(szBuf) / sizeof(TCHAR));
-
-    hMainWnd = CreateWindowEx(WS_EX_CLIENTEDGE,
-                              MYWNDCLASS,
-                              (LPCTSTR)szBuf,
-                              WS_OVERLAPPEDWINDOW,
-                              CW_USEDEFAULT,
-                              CW_USEDEFAULT,
-                              CW_USEDEFAULT,
-                              CW_USEDEFAULT,
-                              NULL,
-                              LoadMenu(hInst, MAKEINTRESOURCE(IDM_MAINMENU)),
-                              hInst,
-                              0);
-    if (!hMainWnd)
-        return 1;
-
-    ShowWindow(hMainWnd, nCmdShow);
-
-    while (GetMessage(&msg, 0, 0, 0))
-    {
-        TranslateMessage(&msg);
-        DispatchMessage(&msg);
-    }
-
-    return 0;
-}
-
 int WINAPI
 _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
 {
@@ -339,7 +47,7 @@
 
     /* Show the control panel window if no argument or "panel" was passed */
     if(lpCmdLine[0] == 0 || !_tcsicmp(lpCmdLine, _T("panel")))
-        return RunControlPanelWindow(nCmdShow);
+        return OpenShellFolder(_T(""));
 
     /* Check one of the built-in control panel handlers */
     if (!_tcsicmp(lpCmdLine, _T("admintools")))           return OpenShellFolder(_T("\\::{D20EA4E1-3957-11d2-A40B-0C5020524153}"));

Modified: trunk/reactos/base/applications/control/control.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/control.h?rev=33508&r1=33507&r2=33508&view=diff
==============================================================================
--- trunk/reactos/base/applications/control/control.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/control/control.h [iso-8859-1] Tue May 13 16:39:25 2008
@@ -7,14 +7,8 @@
  */
 
 #include <windows.h>
-#include <commctrl.h>
-#include <cpl.h>
 #include <tchar.h>
-
 #include "resource.h"
-
-#define MYWNDCLASS _T("CTLPANELCLASS")
-typedef LONG (CALLBACK *CPLAPPLETFUNC)(HWND hwndCPL, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
 
 #define CCH_UINT_MAX   11
 #define MAX_VALUE_NAME 16383

Modified: trunk/reactos/base/applications/control/control.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/control.rbuild?rev=33508&r1=33507&r2=33508&view=diff
==============================================================================
--- trunk/reactos/base/applications/control/control.rbuild [iso-8859-1] (original)
+++ trunk/reactos/base/applications/control/control.rbuild [iso-8859-1] Tue May 13 16:39:25 2008
@@ -2,13 +2,9 @@
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
 <module name="control" type="win32gui" baseaddress="${BASEADDRESS_CONTROL}" installbase="system32" installname="control.exe" unicode="yes">
 	<include base="control">.</include>
-	<define name="_WIN32_IE">0x600</define>
-	<define name="_WIN32_WINNT">0x501</define>
 	<library>advapi32</library>
-	<library>comctl32</library>
 	<library>kernel32</library>
 	<library>shell32</library>
-	<library>user32</library>
 	<file>control.c</file>
 	<file>control.rc</file>
 </module>

Modified: trunk/reactos/base/applications/control/control.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/control.rc?rev=33508&r1=33507&r2=33508&view=diff
==============================================================================
--- trunk/reactos/base/applications/control/control.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/control/control.rc [iso-8859-1] Tue May 13 16:39:25 2008
@@ -1,23 +1,8 @@
-//Microsoft Developer Studio generated resource script.
-//
 #include "resource.h"
-#include <windows.h>
 
 #define REACTOS_STR_FILE_DESCRIPTION	"ReactOS System Control Panel\0"
 #define REACTOS_STR_INTERNAL_NAME	"control\0"
 #define REACTOS_STR_ORIGINAL_FILENAME	"control.exe\0"
 #include <reactos/version.rc>
 
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
 IDI_MAINICON            ICON    DISCARDABLE     "resources/config.ico"
-/////////////////////////////////////////////////////////////////////////////
-
-
-#include "rsrc.rc"

Modified: trunk/reactos/base/applications/control/resource.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/resource.h?rev=33508&r1=33507&r2=33508&view=diff
==============================================================================
--- trunk/reactos/base/applications/control/resource.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/control/resource.h [iso-8859-1] Tue May 13 16:39:25 2008
@@ -1,31 +1,1 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by control.rc
-//
 #define IDI_MAINICON                    100
-#define IDM_MAINMENU                    101
-#define IDM_LARGEICONS                  40000
-#define IDM_SMALLICONS                  40001
-#define IDM_LIST                        40002
-#define IDM_DETAILS                     40003
-#define IDM_ABOUT                       40004
-#define IDM_CLOSE                       40005
-
-/* Strings */
-#define IDS_WINDOW_TITLE                5000
-#define IDS_ABOUT                       5001
-#define IDS_ABOUT_TITLE                 5002
-#define IDS_NO_ITEMS                    5003
-#define IDS_NAME                        5004
-#define IDS_COMMENT                     5005
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        102
-#define _APS_NEXT_COMMAND_VALUE         40006
-#define _APS_NEXT_CONTROL_VALUE         1000
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif

Removed: trunk/reactos/base/applications/control/rsrc.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/rsrc.rc?rev=33507&view=auto
==============================================================================
--- trunk/reactos/base/applications/control/rsrc.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/control/rsrc.rc (removed)
@@ -1,36 +1,0 @@
-
-
-#include <windows.h>
-#include "resource.h"
-
-/* define language neutral resources */
-
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-
-/* include localised resources */
-#include "lang/bg-BG.rc"
-#include "lang/ca-ES.rc"
-#include "lang/cs-CZ.rc"
-#include "lang/da-DK.rc"
-#include "lang/de-DE.rc"
-#include "lang/el-GR.rc"
-#include "lang/en-US.rc"
-#include "lang/es-ES.rc"
-#include "lang/fi-FI.rc"
-#include "lang/fr-FR.rc"
-#include "lang/hu-HU.rc"
-#include "lang/id-ID.rc"
-#include "lang/it-IT.rc"
-#include "lang/ja-JP.rc"
-#include "lang/ko-KO.rc"
-#include "lang/lt-LT.rc"
-#include "lang/nb-NO.rc"
-#include "lang/nl-NL.rc"
-#include "lang/pl-PL.rc"
-#include "lang/pt-BR.rc"
-#include "lang/ru-RU.rc"
-#include "lang/sk-SK.rc"
-#include "lang/sv-SE.rc"
-#include "lang/th-TH.rc"
-#include "lang/uk-UA.rc"
-#include "lang/zh-CN.rc"



More information about the Ros-diffs mailing list