ReactOS 0.4.17-dev-573-g8315b8c
msconfig.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Applications
3 * LICENSE: LGPL - See COPYING in the top level directory
4 * FILE: base/applications/msconfig/msconfig.c
5 * PURPOSE: msconfig main dialog
6 * COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph@ApiViewer.de>
7 *
8 */
9
10#include "precomp.h"
11
12#include "toolspage.h"
13#include "srvpage.h"
14#include "startuppage.h"
15#include "freeldrpage.h"
16#include "systempage.h"
17#include "generalpage.h"
18
20
21HWND hMainWnd; /* Main Window */
22HWND hTabWnd; /* Tab Control Window */
23UINT uXIcon = 0, uYIcon = 0; /* Icon sizes */
26
28
30// Taken from WinSpy++ 1.7
31// http://www.catch22.net/software/winspy
32// Copyright (c) 2002 by J Brown
33//
34
35//
36// Copied from uxtheme.h
37// If you have this new header, then delete these and
38// #include <uxtheme.h> instead!
39//
40#define ETDT_DISABLE 0x00000001
41#define ETDT_ENABLE 0x00000002
42#define ETDT_USETABTEXTURE 0x00000004
43#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
44
45//
47
48//
49// Try to call EnableThemeDialogTexture, if uxtheme.dll is present
50//
52{
53 HMODULE hUXTheme;
55
56 hUXTheme = LoadLibrary(_T("uxtheme.dll"));
57
58 if(hUXTheme)
59 {
61 (ETDTProc)GetProcAddress(hUXTheme, "EnableThemeDialogTexture");
62
64 {
66
67 FreeLibrary(hUXTheme);
68 return TRUE;
69 }
70 else
71 {
72 // Failed to locate API!
73 FreeLibrary(hUXTheme);
74 return FALSE;
75 }
76 }
77 else
78 {
79 // Not running under XP? Just fail gracefully
80 return FALSE;
81 }
82}
83
84VOID DisableAllExcept(HWND hTabDlg, UINT idExcept)
85{
86 HWND hSkip = GetDlgItem(hTabDlg, idExcept);
87 for (HWND hWnd = NULL; (hWnd = FindWindowExW(hTabDlg, hWnd, NULL, NULL)) != NULL;)
88 EnableWindow(hWnd, hWnd == hSkip);
89 if (idExcept == IDC_SYSTEM_TREE && hSkip)
90 {
92 style &= ~TVS_EDITLABELS;
94 }
95}
96
98{
99 TCHAR szTemp[256];
100 TCITEM item;
101
109
110 LoadString(hInst, IDS_MSCONFIG, szTemp, 256);
111 SetWindowText(hWnd, szTemp);
112
113 // Insert Tab Pages
114 LoadString(hInst, IDS_TAB_GENERAL, szTemp, 256);
115 memset(&item, 0, sizeof(TCITEM));
116 item.mask = TCIF_TEXT;
117 item.pszText = szTemp;
119
120 LoadString(hInst, IDS_TAB_SYSTEM, szTemp, 256);
121 memset(&item, 0, sizeof(TCITEM));
122 item.mask = TCIF_TEXT;
123 item.pszText = szTemp;
125
126 LoadString(hInst, IDS_TAB_FREELDR, szTemp, 256);
127 memset(&item, 0, sizeof(TCITEM));
128 item.mask = TCIF_TEXT;
129 item.pszText = szTemp;
131
132 LoadString(hInst, IDS_TAB_SERVICES, szTemp, 256);
133 memset(&item, 0, sizeof(TCITEM));
134 item.mask = TCIF_TEXT;
135 item.pszText = szTemp;
137
138 LoadString(hInst, IDS_TAB_STARTUP, szTemp, 256);
139 memset(&item, 0, sizeof(TCITEM));
140 item.mask = TCIF_TEXT;
141 item.pszText = szTemp;
143
144 LoadString(hInst, IDS_TAB_TOOLS, szTemp, 256);
145 memset(&item, 0, sizeof(TCITEM));
146 item.mask = TCIF_TEXT;
147 item.pszText = szTemp;
149
151
152 // FIXME: We don't support applying anything
156 return TRUE;
157}
158
159
161{
162 switch (TabCtrl_GetCurSel(hTabWnd)) {
163 case 0: //General
171 break;
172 case 1: //SYSTEM.INI
180 break;
181 case 2: //Freeldr
189 break;
190 case 3: //Services
198 break;
199 case 4: //startup
207 break;
208 case 5: //Tools
216 break;
217 }
218}
219
220
221static
222VOID
224{
227
233 uXIcon,
234 uYIcon,
235 0);
236 SendMessage(hDlg,
237 WM_SETICON,
238 ICON_BIG,
240 SendMessage(hDlg,
241 WM_SETICON,
244}
245
246
247/* Message handler for dialog box. */
250{
251 LPNMHDR pnmh;
252 UINT uXIconNew, uYIconNew;
253
254 switch (message)
255 {
256 case WM_INITDIALOG:
257 hMainWnd = hDlg;
258
261
262 SetDialogIcon(hDlg);
263
264 return OnCreate(hDlg);
265
266 case WM_SETTINGCHANGE:
267 uXIconNew = GetSystemMetrics(SM_CXSMICON);
268 uYIconNew = GetSystemMetrics(SM_CYSMICON);
269
270 if ((uXIcon != uXIconNew) || (uYIcon != uYIconNew))
271 {
272 uXIcon = uXIconNew;
273 uYIcon = uYIconNew;
274 SetDialogIcon(hDlg);
275 }
276 break;
277
278 case WM_COMMAND:
279
280 if (LOWORD(wParam) == IDOK)
281 {
282 //MsConfig_OnSaveChanges();
283 }
284
285 if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
286 EndDialog(hDlg, LOWORD(wParam));
287 return TRUE;
288 }
289 break;
290
291 case WM_NOTIFY:
292 pnmh = (LPNMHDR)lParam;
293 if ((pnmh->hwndFrom == hTabWnd) &&
294 (pnmh->idFrom == IDC_TAB) &&
295 (pnmh->code == TCN_SELCHANGE))
296 {
298 }
299 break;
300
302 /* Forward WM_SYSCOLORCHANGE to common controls */
306 break;
307
308 case WM_DESTROY:
309 if (hToolsPage)
311 if (hGeneralPage)
313 if (hServicesPage)
315 if (hStartupPage)
317 if (hFreeLdrPage)
319 if (hSystemPage)
321 if (hDialogIconBig)
325 return DefWindowProc(hDlg, message, wParam, lParam);
326 }
327
328 return 0;
329}
330
332 HINSTANCE hPrevInstance,
333 LPTSTR lpCmdLine,
334 int nCmdShow)
335{
336
338
339 UNREFERENCED_PARAMETER(hPrevInstance);
340 UNREFERENCED_PARAMETER(lpCmdLine);
341 UNREFERENCED_PARAMETER(nCmdShow);
342
343 InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
346
348
350
351 return 0;
352}
353
354/* EOF */
Arabic default style
Definition: afstyles.h:94
HWND hWnd
Definition: settings.c:17
INT_PTR CALLBACK SystemPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: system.c:393
#define IDI_APPICON
Definition: resource.h:166
#define IDD_GENERAL_PAGE
Definition: resource.h:6
#define IDS_TAB_TOOLS
Definition: resource.h:72
#define IDD_FREELDR_PAGE
Definition: resource.h:8
#define IDC_TAB
Definition: resource.h:12
#define IDD_TOOLS_PAGE
Definition: resource.h:4
#define IDC_BTN_APPLY
Definition: resource.h:13
#define IDS_TAB_FREELDR
Definition: resource.h:74
#define IDD_STARTUP_PAGE
Definition: resource.h:7
#define IDD_MSCONFIG_DIALOG
Definition: resource.h:3
#define IDS_TAB_STARTUP
Definition: resource.h:75
#define IDD_SERVICES_PAGE
Definition: resource.h:5
#define IDD_SYSTEM_PAGE
Definition: resource.h:9
#define IDC_BTN_HELP
Definition: resource.h:14
#define IDC_SYSTEM_TREE
Definition: resource.h:68
#define IDS_MSCONFIG
Definition: resource.h:114
#define IDS_TAB_GENERAL
Definition: resource.h:77
#define IDS_TAB_SERVICES
Definition: resource.h:76
#define IDS_TAB_SYSTEM
Definition: resource.h:73
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:904
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
HANDLE HWND
Definition: compat.h:19
#define CALLBACK
Definition: compat.h:35
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned int UINT
Definition: sysinfo.c:13
char TCHAR
Definition: tchar.h:1402
#define _tWinMain
Definition: tchar.h:498
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
static HICON
Definition: imagelist.c:80
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:303
LPSTR LPTSTR
Definition: ms-dtyp.idl:131
LPCSTR LPCTSTR
Definition: ms-dtyp.idl:130
HWND hFreeLdrPage
Definition: freeldrpage.c:12
INT_PTR CALLBACK FreeLdrPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: freeldrpage.c:134
HWND hGeneralPage
Definition: generalpage.c:12
INT_PTR CALLBACK GeneralPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: generalpage.c:25
HRESULT(WINAPI * ETDTProc)(HWND, DWORD)
Definition: msconfig.c:46
#define ETDT_ENABLETAB
Definition: msconfig.c:43
BOOL OnCreate(HWND hWnd)
Definition: msconfig.c:97
INT_PTR CALLBACK MsConfigWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: msconfig.c:249
HINSTANCE hInst
Definition: msconfig.c:19
HICON hDialogIconSmall
Definition: msconfig.c:25
BOOL EnableDialogTheme(HWND hwnd)
Definition: msconfig.c:51
HWND hMainWnd
Definition: msconfig.c:21
UINT uYIcon
Definition: msconfig.c:23
void MsConfig_OnTabWndSelChange(void)
Definition: msconfig.c:160
UINT uXIcon
Definition: msconfig.c:23
VOID DisableAllExcept(HWND hTabDlg, UINT idExcept)
Definition: msconfig.c:84
HICON hDialogIconBig
Definition: msconfig.c:24
HWND hTabWnd
Definition: msconfig.c:22
static VOID SetDialogIcon(HWND hDlg)
Definition: msconfig.c:223
HWND hStartupListCtrl
Definition: startuppage.c:13
HWND hStartupPage
Definition: startuppage.c:12
INT_PTR CALLBACK StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: startuppage.c:20
HWND hSystemPage
Definition: systempage.c:12
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define DWORD
Definition: nt_native.h:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define LOWORD(l)
Definition: pedump.c:82
#define TabCtrl_GetCurSel(hwnd)
Definition: commctrl.h:4068
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define TCITEM
Definition: commctrl.h:4034
#define ICC_TAB_CLASSES
Definition: commctrl.h:61
#define TabCtrl_InsertItem(hwnd, iItem, pitem)
Definition: commctrl.h:4056
#define TCN_SELCHANGE
Definition: commctrl.h:4137
#define TCIF_TEXT
Definition: commctrl.h:3976
#define ICC_LISTVIEW_CLASSES
Definition: commctrl.h:58
#define WM_NOTIFY
Definition: richedit.h:61
#define DefWindowProc
Definition: ros2win.h:31
#define memset(x, y, z)
Definition: compat.h:39
HWND hServicesListCtrl
Definition: srvpage.c:16
HWND hServicesPage
Definition: srvpage.c:15
INT_PTR CALLBACK ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: srvpage.c:22
Definition: tftpd.h:60
UINT_PTR idFrom
Definition: winuser.h:3266
UINT code
Definition: winuser.h:3267
HWND hwndFrom
Definition: winuser.h:3265
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
HWND hToolsPage
Definition: toolspage.c:14
INT_PTR CALLBACK ToolsPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: toolspage.c:56
HWND hToolsListCtrl
Definition: toolspage.c:15
int32_t INT_PTR
Definition: typedefs.h:64
static ETDTProc fnEnableThemeDialogTexture
Definition: uxthemesupp.c:15
#define _T(x)
Definition: vfdio.h:22
#define LoadLibrary
Definition: winbase.h:3583
#define GetModuleHandle
Definition: winbase.h:3548
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define SW_HIDE
Definition: winuser.h:779
#define GetWindowLongPtrW
Definition: winuser.h:4983
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:842
#define IMAGE_ICON
Definition: winuser.h:212
#define WM_COMMAND
Definition: winuser.h:1768
#define CreateDialog
Definition: winuser.h:5915
#define SM_CYSMICON
Definition: winuser.h:1024
#define WM_INITDIALOG
Definition: winuser.h:1767
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1654
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define WM_SETTINGCHANGE
Definition: winuser.h:1657
HWND WINAPI FindWindowExW(_In_opt_ HWND, _In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR)
#define SM_CXSMICON
Definition: winuser.h:1023
struct tagNMHDR * LPNMHDR
#define SendMessage
Definition: winuser.h:6009
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LoadImage
Definition: winuser.h:5981
#define LoadString
Definition: winuser.h:5985
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1637
#define SetWindowText
Definition: winuser.h:6023
#define SetWindowLongPtrW
Definition: winuser.h:5512
#define GWL_STYLE
Definition: winuser.h:863
BOOL WINAPI DestroyWindow(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2444
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI BringWindowToTop(_In_ HWND)
#define DialogBox
Definition: winuser.h:5927
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2422