mirror of
https://github.com/reactos/reactos.git
synced 2024-10-01 06:57:08 +00:00
[DESK.CPL]
Modify font enumeration code to deal with failure to read the registry key. Also change the registry key being queried to match the one used on Windows. Patch by Ricardo Hanke. CORE-8203 svn path=/trunk/; revision=65621
This commit is contained in:
parent
34dee12ec2
commit
aa7bd0b1b7
|
@ -26,8 +26,21 @@ InitFontSizeList(HWND hWnd)
|
||||||
{
|
{
|
||||||
if (SetupFindFirstLine(hInf, _T("Font Sizes"), NULL, &Context))
|
if (SetupFindFirstLine(hInf, _T("Font Sizes"), NULL, &Context))
|
||||||
{
|
{
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontDPI"),
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\Software\\Fonts"),
|
||||||
0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
dwSize = MAX_PATH;
|
||||||
|
dwType = REG_DWORD;
|
||||||
|
|
||||||
|
if (!RegQueryValueEx(hKey, _T("LogPixels"), NULL,
|
||||||
|
&dwType, (LPBYTE)&dwValue, &dwSize) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
dwValue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
TCHAR Buffer[LINE_LEN];
|
TCHAR Buffer[LINE_LEN];
|
||||||
|
@ -41,23 +54,17 @@ InitFontSizeList(HWND hWnd)
|
||||||
if (i != CB_ERR)
|
if (i != CB_ERR)
|
||||||
SendMessage(hFontSize, CB_SETITEMDATA, (WPARAM)i, (LPARAM)ci);
|
SendMessage(hFontSize, CB_SETITEMDATA, (WPARAM)i, (LPARAM)ci);
|
||||||
|
|
||||||
dwSize = MAX_PATH;
|
if ((int)dwValue == ci)
|
||||||
dwType = REG_DWORD;
|
|
||||||
|
|
||||||
if (RegQueryValueEx(hKey, _T("LogPixels"), NULL,
|
|
||||||
&dwType, (LPBYTE)&dwValue, &dwSize) == ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
if ((int)dwValue == ci)
|
SendMessage(hFontSize, CB_SETCURSEL, (WPARAM)i, 0);
|
||||||
{
|
SetWindowText(GetDlgItem(hWnd, IDC_FONTSIZE_CUSTOM), Desc);
|
||||||
SendMessage(hFontSize, CB_SETCURSEL, (WPARAM)i, 0);
|
|
||||||
SetWindowText(GetDlgItem(hWnd, IDC_FONTSIZE_CUSTOM), Desc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
SendMessage(hFontSize, CB_SETCURSEL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetupFindNextLine(&Context, &Context))
|
if (!SetupFindNextLine(&Context, &Context))
|
||||||
{
|
{
|
||||||
RegCloseKey(hKey);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue