ReactOS  0.4.12-dev-721-g03c3dd5
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 
21 HWND hMainWnd; /* Main Window */
22 HWND hTabWnd; /* Tab Control Window */
23 UINT 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 //
46 typedef HRESULT (WINAPI * ETDTProc) (HWND, DWORD);
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 }
84 {
85  TCHAR szTemp[256];
86  TCITEM item;
87 
95 
96  LoadString(hInst, IDS_MSCONFIG, szTemp, 256);
97  SetWindowText(hWnd, szTemp);
98 
99  // Insert Tab Pages
100  LoadString(hInst, IDS_TAB_GENERAL, szTemp, 256);
101  memset(&item, 0, sizeof(TCITEM));
102  item.mask = TCIF_TEXT;
103  item.pszText = szTemp;
105 
106  LoadString(hInst, IDS_TAB_SYSTEM, szTemp, 256);
107  memset(&item, 0, sizeof(TCITEM));
108  item.mask = TCIF_TEXT;
109  item.pszText = szTemp;
111 
112  LoadString(hInst, IDS_TAB_FREELDR, szTemp, 256);
113  memset(&item, 0, sizeof(TCITEM));
114  item.mask = TCIF_TEXT;
115  item.pszText = szTemp;
117 
118  LoadString(hInst, IDS_TAB_SERVICES, szTemp, 256);
119  memset(&item, 0, sizeof(TCITEM));
120  item.mask = TCIF_TEXT;
121  item.pszText = szTemp;
123 
124  LoadString(hInst, IDS_TAB_STARTUP, szTemp, 256);
125  memset(&item, 0, sizeof(TCITEM));
126  item.mask = TCIF_TEXT;
127  item.pszText = szTemp;
129 
130  LoadString(hInst, IDS_TAB_TOOLS, szTemp, 256);
131  memset(&item, 0, sizeof(TCITEM));
132  item.mask = TCIF_TEXT;
133  item.pszText = szTemp;
135 
137 
138  return TRUE;
139 }
140 
141 
143 {
144  switch (TabCtrl_GetCurSel(hTabWnd)) {
145  case 0: //General
153  break;
154  case 1: //SYSTEM.INI
162  break;
163  case 2: //Freeldr
171  break;
172  case 3: //Services
180  break;
181  case 4: //startup
189  break;
190  case 5: //Tools
198  break;
199  }
200 }
201 
202 
203 static
204 VOID
206 {
209 
214  IMAGE_ICON,
215  uXIcon,
216  uYIcon,
217  0);
218  SendMessage(hDlg,
219  WM_SETICON,
220  ICON_BIG,
222  SendMessage(hDlg,
223  WM_SETICON,
224  ICON_SMALL,
226 }
227 
228 
229 /* Message handler for dialog box. */
232 {
233  LPNMHDR pnmh;
234  UINT uXIconNew, uYIconNew;
235 
236  switch (message)
237  {
238  case WM_INITDIALOG:
239  hMainWnd = hDlg;
240 
243 
244  SetDialogIcon(hDlg);
245 
246  return OnCreate(hDlg);
247 
248  case WM_SETTINGCHANGE:
249  uXIconNew = GetSystemMetrics(SM_CXSMICON);
250  uYIconNew = GetSystemMetrics(SM_CYSMICON);
251 
252  if ((uXIcon != uXIconNew) || (uYIcon != uYIconNew))
253  {
254  uXIcon = uXIconNew;
255  uYIcon = uYIconNew;
256  SetDialogIcon(hDlg);
257  }
258  break;
259 
260  case WM_COMMAND:
261 
262  if (LOWORD(wParam) == IDOK)
263  {
264  //MsConfig_OnSaveChanges();
265  }
266 
267  if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
268  EndDialog(hDlg, LOWORD(wParam));
269  return TRUE;
270  }
271  break;
272 
273  case WM_NOTIFY:
274  pnmh = (LPNMHDR)lParam;
275  if ((pnmh->hwndFrom == hTabWnd) &&
276  (pnmh->idFrom == IDC_TAB) &&
277  (pnmh->code == TCN_SELCHANGE))
278  {
280  }
281  break;
282 
283  case WM_SYSCOLORCHANGE:
284  /* Forward WM_SYSCOLORCHANGE to common controls */
288  break;
289 
290  case WM_DESTROY:
291  if (hToolsPage)
293  if (hGeneralPage)
295  if (hServicesPage)
297  if (hStartupPage)
299  if (hFreeLdrPage)
301  if (hSystemPage)
303  if (hDialogIconBig)
305  if (hDialogIconSmall)
307  return DefWindowProc(hDlg, message, wParam, lParam);
308  }
309 
310  return 0;
311 }
312 
314  HINSTANCE hPrevInstance,
315  LPTSTR lpCmdLine,
316  int nCmdShow)
317 {
318 
320 
321  UNREFERENCED_PARAMETER(hPrevInstance);
322  UNREFERENCED_PARAMETER(lpCmdLine);
323  UNREFERENCED_PARAMETER(nCmdShow);
324 
325  InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
328 
329  hInst = hInstance;
330 
332 
333  return 0;
334 }
335 
336 /* EOF */
UINT uYIcon
Definition: msconfig.c:23
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
Definition: tftpd.h:59
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define IDOK
Definition: winuser.h:824
#define IMAGE_ICON
Definition: winuser.h:212
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:47
#define LoadLibrary
Definition: winbase.h:3676
#define IDC_TAB
Definition: resource.h:12
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define SW_HIDE
Definition: winuser.h:762
#define DWORD
Definition: msvc.h:34
HINSTANCE hInst
Definition: msconfig.c:19
HICON hDialogIconSmall
Definition: msconfig.c:25
#define CALLBACK
Definition: compat.h:27
HWND hWnd
Definition: settings.c:17
HANDLE HWND
Definition: compat.h:13
#define IDS_TAB_TOOLS
Definition: resource.h:72
#define SM_CYSMICON
Definition: winuser.h:1003
#define TabCtrl_GetCurSel(hwnd)
Definition: commctrl.h:4035
INT_PTR CALLBACK ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: srvpage.c:22
#define TCIF_TEXT
Definition: commctrl.h:3943
static VOID SetDialogIcon(HWND hDlg)
Definition: msconfig.c:205
#define ETDT_ENABLETAB
Definition: msconfig.c:43
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:62
HWND hSystemPage
Definition: systempage.c:12
BOOL WINAPI DestroyWindow(_In_ HWND)
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
HWND hToolsListCtrl
Definition: toolspage.c:15
#define IDD_TOOLS_PAGE
Definition: resource.h:4
CHAR * LPTSTR
Definition: xmlstorage.h:192
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:303
struct tagNMHDR * LPNMHDR
#define WM_SETTINGCHANGE
Definition: winuser.h:1611
HWND hMainWnd
Definition: msconfig.c:21
UINT_PTR WPARAM
Definition: windef.h:207
#define ICON_SMALL
Definition: tnclass.cpp:48
UINT code
Definition: winuser.h:3112
INT_PTR CALLBACK SystemPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: system.c:383
#define DialogBox
Definition: winuser.h:5627
#define IDS_TAB_GENERAL
Definition: resource.h:77
HINSTANCE hInstance
Definition: charmap.c:20
#define IDD_SYSTEM_PAGE
Definition: resource.h:9
HWND hTabWnd
Definition: msconfig.c:22
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR idFrom
Definition: winuser.h:3111
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
Definition: msconfig.c:313
BOOL WINAPI BringWindowToTop(_In_ HWND)
smooth NULL
Definition: ftsmooth.c:416
#define IDS_TAB_SERVICES
Definition: resource.h:76
BOOL EnableDialogTheme(HWND hwnd)
Definition: msconfig.c:51
#define SW_SHOW
Definition: winuser.h:769
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
char TCHAR
Definition: xmlstorage.h:189
#define TCN_SELCHANGE
Definition: commctrl.h:4104
#define _T(x)
Definition: vfdio.h:22
#define FreeLibrary(x)
Definition: compat.h:405
unsigned int BOOL
Definition: ntddk_ex.h:94
INT_PTR CALLBACK FreeLdrPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: freeldrpage.c:134
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static ETDTProc fnEnableThemeDialogTexture
Definition: uxthemesupp.c:15
unsigned int UINT
Definition: ndis.h:50
int WINAPI GetSystemMetrics(_In_ int)
#define IDS_TAB_STARTUP
Definition: resource.h:75
void MsConfig_OnTabWndSelChange(void)
Definition: msconfig.c:142
#define IDS_MSCONFIG
Definition: resource.h:114
HWND hServicesPage
Definition: srvpage.c:15
#define SM_CXSMICON
Definition: winuser.h:1002
#define IDS_TAB_SYSTEM
Definition: resource.h:73
#define IDD_MSCONFIG_DIALOG
Definition: resource.h:3
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
INT_PTR CALLBACK MsConfigWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: msconfig.c:231
#define IDS_TAB_FREELDR
Definition: resource.h:74
#define WM_COMMAND
Definition: winuser.h:1716
HWND hwndFrom
Definition: winuser.h:3110
HWND hFreeLdrPage
Definition: freeldrpage.c:12
HWND hServicesListCtrl
Definition: srvpage.c:16
#define WINAPI
Definition: msvc.h:20
#define IDI_APPICON
Definition: resource.h:166
#define IDD_GENERAL_PAGE
Definition: resource.h:6
HICON hDialogIconBig
Definition: msconfig.c:24
HWND hGeneralPage
Definition: generalpage.c:12
#define ICC_LISTVIEW_CLASSES
Definition: commctrl.h:58
#define IDD_SERVICES_PAGE
Definition: resource.h:5
static ATOM item
Definition: dde.c:856
#define GetModuleHandle
Definition: winbase.h:3641
HWND hToolsPage
Definition: toolspage.c:14
#define SetWindowText
Definition: winuser.h:5723
HRESULT(WINAPI * ETDTProc)(HWND, DWORD)
Definition: msconfig.c:46
INT_PTR CALLBACK ToolsPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: toolspage.c:56
#define TabCtrl_InsertItem(hwnd, iItem, pitem)
Definition: commctrl.h:4023
#define SendMessage
Definition: winuser.h:5709
HWND hStartupPage
Definition: startuppage.c:12
INT_PTR CALLBACK StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: startuppage.c:20
#define HRESULT
Definition: msvc.h:21
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define GetProcAddress(x, y)
Definition: compat.h:410
#define LoadImage
Definition: winuser.h:5681
#define TCITEM
Definition: commctrl.h:4001
#define IDCANCEL
Definition: winuser.h:825
#define IDD_FREELDR_PAGE
Definition: resource.h:8
#define IDD_STARTUP_PAGE
Definition: resource.h:7
#define memset(x, y, z)
Definition: compat.h:39
INT_PTR CALLBACK GeneralPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: generalpage.c:25
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define LoadString
Definition: winuser.h:5685
HWND hStartupListCtrl
Definition: startuppage.c:13
UINT uXIcon
Definition: msconfig.c:23
#define WM_NOTIFY
Definition: richedit.h:61
BOOL OnCreate(HWND hWnd)
Definition: msconfig.c:83
#define APIENTRY
Definition: api.h:79
#define CreateDialog
Definition: winuser.h:5615
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICC_TAB_CLASSES
Definition: commctrl.h:61