ReactOS 0.4.15-dev-7918-g2a2556c
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 * FILE: dll/cpl/desk/advmon.c
5 * PURPOSE: Advanced monitor/display settings
6 */
7
8#include "desk.h"
9
10#define MAX_ADVANCED_PAGES 32
11
12static BOOL CALLBACK
14{
16 if (ppsh != NULL && ppsh->nPages < MAX_ADVANCED_PAGES)
17 {
18 ppsh->phpage[ppsh->nPages++] = hpage;
19 return TRUE;
20 }
21
22 return FALSE;
23}
24
25static BOOL
27{
28 HPROPSHEETPAGE hPage;
29 PROPSHEETPAGE psp;
30
31 if (ppsh->nPages < MAX_ADVANCED_PAGES)
32 {
33 ZeroMemory(&psp, sizeof(psp));
34 psp.dwSize = sizeof(psp);
35 psp.dwFlags = PSP_DEFAULT;
36 psp.hInstance = hApplet;
37 psp.pszTemplate = MAKEINTRESOURCE(idDlg);
38 psp.pfnDlgProc = DlgProc;
39 psp.lParam = lParam;
40
41 hPage = CreatePropertySheetPage(&psp);
42 if (hPage != NULL)
43 {
44 return PropSheetAddPage(hPage, (LPARAM)ppsh);
45 }
46 }
47
48 return FALSE;
49}
50
51static VOID
53{
54 UINT uiMonitorName, uiDisplayName;
55 LPTSTR lpMonitorName, lpDisplayName;
56 TCHAR szFormatBuff[32];
57
58 if (!LoadString(hApplet, IDS_ADVANCEDTITLEFMT, szFormatBuff, sizeof(szFormatBuff) / sizeof(szFormatBuff[0])))
59 {
60 szFormatBuff[0] = _T('\0');
61 }
62
65
66 lpMonitorName = QueryDeskCplString(pdo, uiMonitorName);
67 lpDisplayName = QueryDeskCplString(pdo, uiDisplayName);
68
69 _sntprintf(lpBuffer, dwBufferLen, szFormatBuff, lpMonitorName, lpDisplayName);
70
71 if (lpMonitorName != NULL)
72 LocalFree((HLOCAL)lpMonitorName);
73 if (lpDisplayName != NULL)
75}
76
77BOOL
79{
80 TCHAR szCaption[128];
83 HPSXA hpsxaDev, hpsxaDisp;
84 BOOL Ret;
85 IDataObject *pdo;
86
87 /* FIXME: Build the "%s and %s" caption string for the monitor and adapter name */
88 szCaption[0] = _T('\0');
89
90 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
91 psh.dwSize = sizeof(PROPSHEETHEADER);
92 psh.dwFlags = PSH_PROPTITLE;
93 psh.hwndParent = hWndParent;
94 psh.hInstance = hApplet;
95 psh.pszCaption = szCaption;
96 psh.phpage = hpsp;
97
99
100 pdo = CreateDevSettings(DisplayDevice);
101
102 if (pdo != NULL)
103 BuildAdvPropTitle(pdo, szCaption, sizeof(szCaption) / sizeof(szCaption[0]));
104
106 if (hpsxaDev != NULL)
108
110 if (hpsxaDisp != NULL)
112
113 Ret = (LONG)(PropertySheet(&psh) != -1);
114
115 if (hpsxaDisp != NULL)
117
118 if (hpsxaDev != NULL)
120
121 IDataObject_Release(pdo);
122
123 return Ret;
124}
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: advmon.c:13
BOOL DisplayAdvancedSettings(HWND hWndParent, PDISPLAY_DEVICE_ENTRY DisplayDevice)
Definition: advmon.c:78
static BOOL DisplayAdvancedSettingsInitPropSheetPage(PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc, LPARAM lParam)
Definition: advmon.c:26
#define MAX_ADVANCED_PAGES
Definition: advmon.c:10
static VOID BuildAdvPropTitle(IDataObject *pdo, LPTSTR lpBuffer, DWORD dwBufferLen)
Definition: advmon.c:52
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:2190
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:2013
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:5838
#define LoadString
Definition: winuser.h:5819
#define MAKEINTRESOURCE
Definition: winuser.h:591
char TCHAR
Definition: xmlstorage.h:189
#define _sntprintf
Definition: xmlstorage.h:201
CHAR * LPTSTR
Definition: xmlstorage.h:192