ReactOS 0.4.16-dev-92-g0c2cdca
advmon.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 * PURPOSE: Advanced monitor/display settings
5 */
6
7#include "desk.h"
8
9#define MAX_ADVANCED_PAGES 32
10
11static BOOL CALLBACK
13{
15 if (ppsh != NULL && ppsh->nPages < MAX_ADVANCED_PAGES)
16 {
17 ppsh->phpage[ppsh->nPages++] = hpage;
18 return TRUE;
19 }
20
21 return FALSE;
22}
23
24static BOOL
26{
27 HPROPSHEETPAGE hPage;
28 PROPSHEETPAGE psp;
29
30 if (ppsh->nPages < MAX_ADVANCED_PAGES)
31 {
32 ZeroMemory(&psp, sizeof(psp));
33 psp.dwSize = sizeof(psp);
34 psp.dwFlags = PSP_DEFAULT;
35 psp.hInstance = hApplet;
36 psp.pszTemplate = MAKEINTRESOURCE(idDlg);
37 psp.pfnDlgProc = DlgProc;
38 psp.lParam = lParam;
39
40 hPage = CreatePropertySheetPage(&psp);
41 if (hPage != NULL)
42 {
43 return PropSheetAddPage(hPage, (LPARAM)ppsh);
44 }
45 }
46
47 return FALSE;
48}
49
50static VOID
52{
53 UINT uiMonitorName, uiDisplayName;
54 LPTSTR lpMonitorName, lpDisplayName;
55 TCHAR szFormatBuff[32];
56
57 if (!LoadString(hApplet, IDS_ADVANCEDTITLEFMT, szFormatBuff, _countof(szFormatBuff)))
58 {
59 szFormatBuff[0] = _T('\0');
60 }
61
64
65 lpMonitorName = QueryDeskCplString(pdo, uiMonitorName);
66 lpDisplayName = QueryDeskCplString(pdo, uiDisplayName);
67
68 _sntprintf(lpBuffer, dwBufferLen, szFormatBuff, lpMonitorName, lpDisplayName);
69
70 if (lpMonitorName != NULL)
71 LocalFree((HLOCAL)lpMonitorName);
72 if (lpDisplayName != NULL)
74}
75
76BOOL
78{
79 TCHAR szCaption[128];
82 HPSXA hpsxaDev, hpsxaDisp;
83 BOOL Ret;
84 IDataObject *pdo;
85
86 /* FIXME: Build the "%s and %s" caption string for the monitor and adapter name */
87 szCaption[0] = _T('\0');
88
89 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
90 psh.dwSize = sizeof(PROPSHEETHEADER);
91 psh.dwFlags = PSH_PROPTITLE;
92 psh.hwndParent = hWndParent;
93 psh.hInstance = hApplet;
94 psh.pszCaption = szCaption;
95 psh.phpage = hpsp;
96
98
99 pdo = CreateDevSettings(DisplayDevice);
100
101 if (pdo != NULL)
102 BuildAdvPropTitle(pdo, szCaption, _countof(szCaption));
103
105 if (hpsxaDev != NULL)
107
109 if (hpsxaDisp != NULL)
111
112 Ret = (LONG)(PropertySheet(&psh) != -1);
113
114 if (hpsxaDisp != NULL)
116
117 if (hpsxaDev != NULL)
119
120 IDataObject_Release(pdo);
121
122 return Ret;
123}
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: advmon.c:12
BOOL DisplayAdvancedSettings(HWND hWndParent, PDISPLAY_DEVICE_ENTRY DisplayDevice)
Definition: advmon.c:77
static BOOL DisplayAdvancedSettingsInitPropSheetPage(PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc, LPARAM lParam)
Definition: advmon.c:25
#define MAX_ADVANCED_PAGES
Definition: advmon.c:9
static VOID BuildAdvPropTitle(IDataObject *pdo, LPTSTR lpBuffer, DWORD dwBufferLen)
Definition: advmon.c:51
LPARAM lParam
Definition: combotst.c:139
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define DLGPROC
Definition: maze.c:62
WORD idDlg
Definition: desk.c:121
DLGPROC DlgProc
Definition: desk.c:122
INT_PTR CALLBACK AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: general.c:115
HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY, LPCWSTR, UINT, IDataObject *)
IDataObject * CreateDevSettings(PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
Definition: devsett.c:1045
#define DESK_EXT_MONITORNAME
Definition: deskcplx.h:13
static __inline LPTSTR QueryDeskCplString(IDataObject *pdo, UINT cfFormat)
Definition: deskcplx.h:84
#define DESK_EXT_DISPLAYNAME
Definition: deskcplx.h:9
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define IDD_ADVANCED_GENERAL
Definition: resource.h:18
#define IDS_ADVANCEDTITLEFMT
Definition: resource.h:159
#define CALLBACK
Definition: compat.h:35
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define TEXT(s)
Definition: k32.h:26
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_PROPTITLE
Definition: prsht.h:40
#define CreatePropertySheetPage
Definition: prsht.h:399
#define PSP_DEFAULT
Definition: prsht.h:22
#define PropertySheet
Definition: prsht.h:400
#define PROPSHEETPAGE
Definition: prsht.h:389
#define REGSTR_PATH_CONTROLSFOLDER
Definition: regstr.h:76
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
Definition: shellord.c:2390
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:2213
#define _countof(array)
Definition: sndvol32.h:70
Definition: precomp.h:68
#define _T(x)
Definition: vfdio.h:22
#define ZeroMemory
Definition: winbase.h:1712
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2790
LONG_PTR LPARAM
Definition: windef.h:208
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define RegisterClipboardFormat
Definition: winuser.h:5850
#define LoadString
Definition: winuser.h:5831
#define MAKEINTRESOURCE
Definition: winuser.h:591
char TCHAR
Definition: xmlstorage.h:189
#define _sntprintf
Definition: xmlstorage.h:201
CHAR * LPTSTR
Definition: xmlstorage.h:192