ReactOS 0.4.16-dev-197-g92996da
general.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Display Control Panel
4 * FILE: dll/cpl/desk/general.c
5 * PURPOSE: Advanced General settings
6 */
7
8#include "desk.h"
9
10static VOID
12{
13 HINF hInf;
14 HKEY hKey;
15 HWND hFontSize;
17 int i, ci = 0;
18 DWORD dwSize, dwValue, dwType;
19
21
22 hInf = SetupOpenInfFile(_T("font.inf"), NULL,
24
25 if (hInf != INVALID_HANDLE_VALUE)
26 {
27 if (SetupFindFirstLine(hInf, _T("Font Sizes"), NULL, &Context))
28 {
29 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\Software\\Fonts"),
31 {
33 dwType = REG_DWORD;
34
35 if (RegQueryValueEx(hKey, _T("LogPixels"), NULL, &dwType,
36 (LPBYTE)&dwValue, &dwSize) != ERROR_SUCCESS)
37 {
38 dwValue = 0;
39 }
40
42 }
43
44 for (;;)
45 {
47 TCHAR Desc[LINE_LEN];
48
49 if (SetupGetStringField(&Context, 0, Buffer, sizeof(Buffer) / sizeof(TCHAR), NULL) &&
50 SetupGetIntField(&Context, 1, &ci))
51 {
52 _stprintf(Desc, _T("%s (%d DPI)"), Buffer, ci);
53 i = SendMessage(hFontSize, CB_ADDSTRING, 0, (LPARAM)Desc);
54 if (i != CB_ERR)
55 SendMessage(hFontSize, CB_SETITEMDATA, (WPARAM)i, (LPARAM)ci);
56
57 if ((int)dwValue == ci)
58 {
59 SendMessage(hFontSize, CB_SETCURSEL, (WPARAM)i, 0);
61 }
62 else
63 SendMessage(hFontSize, CB_SETCURSEL, 0, 0);
64 }
65
67 {
68 break;
69 }
70 }
71 }
72 }
73
75}
76
77static VOID
79{
80 HKEY hKey;
81
83 _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Controls Folder\\Display"),
85 {
86 TCHAR szBuf[64];
87 DWORD dwSize = 64;
88
89 if (RegQueryValueEx(hKey, _T("DynaSettingsChange"), 0, NULL,
90 (LPBYTE)szBuf, &dwSize) == ERROR_SUCCESS)
91 {
92 switch (_ttoi(szBuf))
93 {
94 case 0:
96 break;
97 case 1:
99 break;
100 case 3:
102 break;
103 }
104 }
105 else
107
109 }
110 else
112}
113
116 UINT uMsg,
119{
120 PDISPLAY_DEVICE_ENTRY DispDevice = NULL;
121 INT_PTR Ret = 0;
122
123 if (uMsg != WM_INITDIALOG)
124 DispDevice = (PDISPLAY_DEVICE_ENTRY)GetWindowLongPtr(hwndDlg, DWLP_USER);
125
126 switch (uMsg)
127 {
128 case WM_INITDIALOG:
130 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)DispDevice);
131
132 InitFontSizeList(hwndDlg);
133 InitRadioButtons(hwndDlg);
134
135 Ret = TRUE;
136 break;
137 case WM_COMMAND:
138 switch (LOWORD(wParam))
139 {
142 {
143 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
144 }
145 break;
146 case IDC_RESTART_RB:
148 case IDC_ASKME_RB:
149 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
150 break;
151 }
152 break;
153 }
154
155 return Ret;
156}
HWND hWnd
Definition: settings.c:17
struct _DISPLAY_DEVICE_ENTRY * PDISPLAY_DEVICE_ENTRY
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: bufpool.h:45
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static VOID InitRadioButtons(HWND hWnd)
Definition: general.c:78
static VOID InitFontSizeList(HWND hWnd)
Definition: general.c:11
INT_PTR CALLBACK AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: general.c:115
#define IDC_RESTART_RB
Definition: resource.h:196
#define IDC_FONTSIZE_COMBO
Definition: resource.h:194
#define IDC_WITHOUTREBOOT_RB
Definition: resource.h:197
#define IDC_ASKME_RB
Definition: resource.h:198
#define IDC_FONTSIZE_CUSTOM
Definition: resource.h:195
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define INF_STYLE_WIN4
Definition: infsupp.h:41
#define _stprintf
Definition: utility.h:124
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define REG_DWORD
Definition: sdbapi.c:596
#define SetupOpenInfFile
Definition: setupapi.h:2652
#define LINE_LEN
Definition: setupapi.h:20
#define SetupFindFirstLine
Definition: setupapi.h:2624
#define SetupGetStringField
Definition: setupapi.h:2639
Definition: precomp.h:68
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HIWORD(l)
Definition: typedefs.h:247
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:148
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:82
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:45
#define _T(x)
Definition: vfdio.h:22
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegQueryValueEx
Definition: winreg.h:524
#define CB_SETITEMDATA
Definition: winuser.h:1969
#define DWLP_USER
Definition: winuser.h:875
#define WM_COMMAND
Definition: winuser.h:1743
#define CB_ERR
Definition: winuser.h:2438
#define CB_SETCURSEL
Definition: winuser.h:1964
#define WM_INITDIALOG
Definition: winuser.h:1742
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CBN_SELCHANGE
Definition: winuser.h:1982
#define BM_SETCHECK
Definition: winuser.h:1924
#define CB_ADDSTRING
Definition: winuser.h:1939
#define SendMessage
Definition: winuser.h:5855
HWND WINAPI GetParent(_In_ HWND)
#define SetWindowText
Definition: winuser.h:5869
#define SendDlgItemMessage
Definition: winuser.h:5854
char TCHAR
Definition: xmlstorage.h:189
#define _ttoi
Definition: xmlstorage.h:195