started implementing startup page

svn path=/trunk/; revision=19124
This commit is contained in:
Christoph von Wittich 2005-11-10 20:56:49 +00:00
parent 473f2dbaf6
commit f78304d996
9 changed files with 168 additions and 13 deletions

View file

@ -23,6 +23,13 @@ BEGIN
PUSHBUTTON "&Ausführen", IDC_BTN_RUN, 311, 155, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END
IDD_STARTUP_PAGE DIALOG DISCARDABLE 0, 0, 362, 175
STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "Tahoma"
BEGIN
CONTROL "List3",IDC_STARTUP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 168
END
IDD_SERVICES_PAGE DIALOG DISCARDABLE 0, 0, 362, 175
STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "Tahoma"
@ -68,4 +75,8 @@ BEGIN
IDS_TOOLS_SYSDM_DESCR "Zeigt Informationen über diesen Rechner an."
IDS_TOOLS_SYSDM_CMD "control"
IDS_TOOLS_SYSDM_PARAM "sysdm.cpl"
IDS_STARTUP_COLUMN_ELEMENT "Element"
IDS_STARTUP_COLUMN_CMD "Befehl"
IDS_STARTUP_COLUMN_PATH "Pfad"
END

View file

@ -14,6 +14,13 @@ BEGIN
PUSHBUTTON "Apply", IDC_BTN_APPLY, 323, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END
IDD_STARTUP_PAGE DIALOG DISCARDABLE 0, 0, 362, 175
STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "Tahoma"
BEGIN
CONTROL "List3",IDC_STARTUP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 168
END
IDD_TOOLS_PAGE DIALOG DISCARDABLE 0, 0, 362, 175
STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "Tahoma"
@ -67,4 +74,8 @@ BEGIN
IDS_TOOLS_SYSDM_DESCR "Shows information about this computer."
IDS_TOOLS_SYSDM_CMD "control"
IDS_TOOLS_SYSDM_PARAM "sysdm.cpl"
IDS_STARTUP_COLUMN_ELEMENT "Element"
IDS_STARTUP_COLUMN_CMD "Command"
IDS_STARTUP_COLUMN_PATH "Path"
END

View file

@ -14,6 +14,7 @@ BOOL OnCreate(HWND hWnd)
hTabWnd = GetDlgItem(hWnd, IDC_TAB);
hToolsPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TOOLS_PAGE), hWnd, ToolsPageWndProc);
hServicesPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SERVICES_PAGE), hWnd, ServicesPageWndProc);
hStartupPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_STARTUP_PAGE), hWnd, StartupPageWndProc);
// Insert Tab Pages
LoadString(hInst, IDS_TAB_GENERAL, szTemp, 256);
@ -53,32 +54,37 @@ BOOL OnCreate(HWND hWnd)
void MsConfig_OnTabWndSelChange(void)
{
switch (TabCtrl_GetCurSel(hTabWnd)) {
case 0:
case 0: //General
ShowWindow(hToolsPage, SW_HIDE);
ShowWindow(hStartupPage, SW_HIDE);
//ShowWindow(hFreeLdrPage, SW_HIDE);
ShowWindow(hServicesPage, SW_HIDE);
//BringWindowToTop(hFreeLdrPage);
break;
case 1: //Freeldr
ShowWindow(hToolsPage, SW_HIDE);
ShowWindow(hStartupPage, SW_HIDE);
//ShowWindow(hFreeLdrPage, SW_SHOW);
ShowWindow(hServicesPage, SW_HIDE);
//BringWindowToTop(hFreeLdrPage);
break;
case 1:
ShowWindow(hToolsPage, SW_HIDE);
//ShowWindow(hFreeLdrPage, SW_SHOW);
ShowWindow(hServicesPage, SW_HIDE);
//BringWindowToTop(hFreeLdrPage);
break;
case 2:
case 2: //Services
ShowWindow(hToolsPage, SW_HIDE);
ShowWindow(hStartupPage, SW_HIDE);
//ShowWindow(hFreeLdrPage, SW_HIDE);
ShowWindow(hServicesPage, SW_SHOW);
//BringWindowToTop(hFreeLdrPage);
break;
case 3:
case 3: //startup
ShowWindow(hToolsPage, SW_HIDE);
ShowWindow(hStartupPage, SW_SHOW);
//ShowWindow(hFreeLdrPage, SW_HIDE);
ShowWindow(hServicesPage, SW_HIDE);
//BringWindowToTop(hFreeLdrPage);
BringWindowToTop(hStartupPage);
break;
case 4:
case 4: //Tools
ShowWindow(hToolsPage, SW_SHOW);
ShowWindow(hStartupPage, SW_HIDE);
//ShowWindow(hFreeLdrPage, SW_HIDE);
ShowWindow(hServicesPage, SW_HIDE);
BringWindowToTop(hToolsPage);
@ -125,6 +131,7 @@ MsConfigWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_DESTROY:
DestroyWindow(hToolsPage);
DestroyWindow(hServicesPage);
DestroyWindow(hStartupPage);
return DefWindowProc(hDlg, message, wParam, lParam);
}

View file

@ -12,6 +12,7 @@
<library>shell32</library>
<file>toolspage.c</file>
<file>srvpage.c</file>
<file>startuppage.c</file>
<file>msconfig.c</file>
<file>msconfig.rc</file>
</module>

View file

@ -8,4 +8,9 @@
#include "msconfig.h"
#include "toolspage.h"
#include "srvpage.h"
#include "startuppage.h"
#define MAX_KEY_LENGTH 255
#define MAX_VALUE_NAME 16383

View file

@ -11,6 +11,7 @@
#define IDC_BTN_RUN 1005
#define IDC_SERVICES_LIST 1006
#define IDC_TOOLS_LIST 1007
#define IDC_STARTUP_LIST 1008
#define IDS_TAB_TOOLS 2001
#define IDS_TAB_FREELDR 2002
@ -23,6 +24,9 @@
#define IDS_SERVICES_COLUMN_SERVICE 2012
#define IDS_SERVICES_COLUMN_VENDOR 2013
#define IDS_SERVICES_COLUMN_STATUS 2014
#define IDS_STARTUP_COLUMN_ELEMENT 2015
#define IDS_STARTUP_COLUMN_CMD 2016
#define IDS_STARTUP_COLUMN_PATH 2017
#define IDS_TOOLS_CMD_NAME 2100
#define IDS_TOOLS_CMD_DESCR 2101

View file

@ -14,7 +14,7 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_INITDIALOG:
hServicesListCtrl = GetDlgItem(hDlg, IDC_TOOLS_LIST);
hServicesListCtrl = GetDlgItem(hDlg, IDC_SERVICES_LIST);
hServicesDialog = hDlg;
dwStyle = SendMessage(hServicesListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
@ -41,7 +41,7 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
LoadString(hInst, IDS_SERVICES_COLUMN_STATUS, szTemp, 256);
column.pszText = szTemp;
column.cx = 70;
ListView_InsertColumn(hServicesListCtrl, 1, &column);
ListView_InsertColumn(hServicesListCtrl, 2, &column);
return TRUE;
}

View file

@ -0,0 +1,112 @@
#include <precomp.h>
HWND hStartupPage;
HWND hStartupListCtrl;
HWND hStartupDialog;
void GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName );
INT_PTR CALLBACK
StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
LV_COLUMN column;
TCHAR szTemp[256];
DWORD dwStyle;
switch (message) {
case WM_INITDIALOG:
hStartupListCtrl = GetDlgItem(hDlg, IDC_STARTUP_LIST);
hStartupDialog = hDlg;
dwStyle = SendMessage(hStartupListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
dwStyle = dwStyle | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES;
SendMessage(hStartupListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
// Initialize the application page's controls
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_STARTUP_COLUMN_ELEMENT, szTemp, 256);
column.pszText = szTemp;
column.cx = 150;
ListView_InsertColumn(hStartupListCtrl, 0, &column);
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_STARTUP_COLUMN_CMD, szTemp, 256);
column.pszText = szTemp;
column.cx = 150;
ListView_InsertColumn(hStartupListCtrl, 1, &column);
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_STARTUP_COLUMN_PATH, szTemp, 256);
column.pszText = szTemp;
column.cx = 250;
ListView_InsertColumn(hStartupListCtrl, 2, &column);
GetAutostartEntriesFromRegistry(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));
GetAutostartEntriesFromRegistry(HKEY_CURRENT_USER, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));
//FIXME: What about HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit
//FIXME: Common Startup (startmenu)
return TRUE;
}
return 0;
}
void
GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )
{
HKEY hKey;
DWORD Index, dwValues, retVal, dwType;
DWORD dwValueLength, dwDataLength = MAX_VALUE_NAME;
TCHAR Data[MAX_VALUE_NAME];
TCHAR lpValueName[MAX_KEY_LENGTH];
TCHAR Path[MAX_KEY_LENGTH + 5];
LV_ITEM item;
if (RegOpenKeyEx(hRootKey, KeyName, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwValues, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{
for (Index = 0, retVal = ERROR_SUCCESS; Index < dwValues; Index++)
{
dwValueLength = MAX_VALUE_NAME;
dwDataLength = MAX_VALUE_NAME;
retVal = RegEnumValue(hKey, Index, lpValueName, &dwValueLength, NULL, &dwType, (LPBYTE)Data, &dwDataLength);
if (retVal == ERROR_SUCCESS)
{
memset(&item, 0, sizeof(LV_ITEM));
item.mask = LVIF_TEXT;
item.iImage = 0;
item.pszText = lpValueName;
item.iItem = ListView_GetItemCount(hStartupListCtrl);
item.lParam = 0;
ListView_InsertItem(hStartupListCtrl, &item);
if (dwType == REG_SZ)
{
GetLongPathName(Data, Data, sizeof(Data));
item.pszText = Data;
item.iSubItem = 1;
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
}
if (hRootKey == HKEY_LOCAL_MACHINE)
_tcscpy(Path, _T("HKLM\\"));
if (hRootKey == HKEY_CURRENT_USER)
_tcscpy(Path, _T("HKCU\\"));
_tcscat(Path, KeyName);
item.pszText = Path;
item.iSubItem = 2;
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
}
}
}
RegCloseKey(hKey);
}
}

View file

@ -0,0 +1,4 @@
extern HWND hStartupPage;
extern HWND hStartupPageListCtrl;
INT_PTR CALLBACK StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);