ReactOS  0.4.13-dev-247-g0f29b3f
advmon.c File Reference
#include "desk.h"
Include dependency graph for advmon.c:

Go to the source code of this file.

Macros

#define MAX_ADVANCED_PAGES   32
 

Typedefs

typedef HPSXA(WINAPICPSEAE) (HKEY, LPCWSTR, UINT, IDataObject *)
 

Functions

static BOOL CALLBACK PropSheetAddPage (HPROPSHEETPAGE hpage, LPARAM lParam)
 
static BOOL DisplayAdvancedSettingsInitPropSheetPage (PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc, LPARAM lParam)
 
static VOID BuildAdvPropTitle (IDataObject *pdo, LPTSTR lpBuffer, DWORD dwBufferLen)
 
BOOL DisplayAdvancedSettings (HWND hWndParent, PDISPLAY_DEVICE_ENTRY DisplayDevice)
 

Macro Definition Documentation

◆ MAX_ADVANCED_PAGES

#define MAX_ADVANCED_PAGES   32

Definition at line 10 of file advmon.c.

Typedef Documentation

◆ CPSEAE

typedef HPSXA(WINAPI * CPSEAE) (HKEY, LPCWSTR, UINT, IDataObject *)

Definition at line 78 of file advmon.c.

Function Documentation

◆ BuildAdvPropTitle()

static VOID BuildAdvPropTitle ( IDataObject pdo,
LPTSTR  lpBuffer,
DWORD  dwBufferLen 
)
static

Definition at line 52 of file advmon.c.

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 }
#define DESK_EXT_DISPLAYNAME
Definition: deskcplx.h:9
HINSTANCE hApplet
Definition: access.c:17
CHAR * LPTSTR
Definition: xmlstorage.h:192
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define _sntprintf
Definition: xmlstorage.h:201
#define RegisterClipboardFormat
Definition: winuser.h:5704
#define IDS_ADVANCEDTITLEFMT
Definition: resource.h:147
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
unsigned int UINT
Definition: ndis.h:50
static __inline LPTSTR QueryDeskCplString(IDataObject *pdo, UINT cfFormat)
Definition: deskcplx.h:84
#define DESK_EXT_MONITORNAME
Definition: deskcplx.h:13
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
Definition: winbase.h:2730
#define LoadString
Definition: winuser.h:5685

Referenced by DisplayAdvancedSettings().

◆ DisplayAdvancedSettings()

BOOL DisplayAdvancedSettings ( HWND  hWndParent,
PDISPLAY_DEVICE_ENTRY  DisplayDevice 
)

Definition at line 81 of file advmon.c.

82 {
83  TCHAR szCaption[128];
85  PROPSHEETHEADER psh;
86  HPSXA hpsxaDev, hpsxaDisp;
87  BOOL Ret;
88  IDataObject *pdo;
89 #ifdef _MSC_VER
91  CPSEAE msvc_SHCreatePropSheetExtArrayEx;
92 #endif
93 
94  /* FIXME: Build the "%s and %s" caption string for the monitor and adapter name */
95  szCaption[0] = _T('\0');
96 
97  ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
98  psh.dwSize = sizeof(PROPSHEETHEADER);
99  psh.dwFlags = PSH_PROPTITLE;
100  psh.hwndParent = hWndParent;
101  psh.hInstance = hApplet;
102  psh.pszCaption = szCaption;
103  psh.phpage = hpsp;
104 
106 
107  pdo = CreateDevSettings(DisplayDevice);
108 
109  if (pdo != NULL)
110  BuildAdvPropTitle(pdo, szCaption, sizeof(szCaption) / sizeof(szCaption[0]));
111 
112 #ifdef _MSC_VER
113  hShell32 = LoadLibrary(_T("shell32.dll"));
114  if (hShell32 == NULL)
115  return FALSE;
116  msvc_SHCreatePropSheetExtArrayEx = (CPSEAE)GetProcAddress(hShell32, (LPCSTR)194);
117  hpsxaDev = msvc_SHCreatePropSheetExtArrayEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER TEXT("\\Device"), MAX_ADVANCED_PAGES - psh.nPages, pdo);
118 #else
120 #endif
121  if (hpsxaDev != NULL)
123 
124 #ifdef _MSC_VER
125  hpsxaDisp = msvc_SHCreatePropSheetExtArrayEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER TEXT("\\Device"), MAX_ADVANCED_PAGES - psh.nPages, pdo);
126 #else
128 #endif
129  if (hpsxaDisp != NULL)
131 
132  Ret = (LONG)(PropertySheet(&psh) != -1);
133 
134  if (hpsxaDisp != NULL)
135  SHDestroyPropSheetExtArray(hpsxaDisp);
136 
137  if (hpsxaDev != NULL)
138  SHDestroyPropSheetExtArray(hpsxaDev);
139 
140  IDataObject_Release(pdo);
141 
142 #ifdef _MSC_VER
143  if (hShell32)
145 #endif
146 
147  return Ret;
148 }
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
Definition: shellord.c:1755
#define MAX_ADVANCED_PAGES
Definition: advmon.c:10
#define LoadLibrary
Definition: winbase.h:3676
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:1577
#define REGSTR_PATH_CONTROLSFOLDER
Definition: regstr.h:76
#define ZeroMemory
Definition: winbase.h:1635
HINSTANCE hApplet
Definition: access.c:17
#define IDD_ADVANCED_GENERAL
Definition: resource.h:16
HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY, LPCWSTR, UINT, IDataObject *)
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
HPSXA(WINAPI * CPSEAE)(HKEY, LPCWSTR, UINT, IDataObject *)
Definition: advmon.c:78
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:374
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
static BOOL DisplayAdvancedSettingsInitPropSheetPage(PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc, LPARAM lParam)
Definition: advmon.c:26
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define FreeLibrary(x)
Definition: compat.h:405
#define PSH_PROPTITLE
Definition: prsht.h:40
static VOID BuildAdvPropTitle(IDataObject *pdo, LPTSTR lpBuffer, DWORD dwBufferLen)
Definition: advmon.c:52
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: advmon.c:13
#define TEXT(s)
Definition: k32.h:26
#define PropertySheet
Definition: prsht.h:382
IDataObject * CreateDevSettings(PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
Definition: devsett.c:887
#define GetProcAddress(x, y)
Definition: compat.h:410
INT_PTR CALLBACK AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: general.c:115
static HMODULE hShell32
Definition: string.c:34
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by SettingsPageProc().

◆ DisplayAdvancedSettingsInitPropSheetPage()

static BOOL DisplayAdvancedSettingsInitPropSheetPage ( PROPSHEETHEADER ppsh,
WORD  idDlg,
DLGPROC  DlgProc,
LPARAM  lParam 
)
static

Definition at line 26 of file advmon.c.

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 }
WORD idDlg
Definition: desk.c:109
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define MAX_ADVANCED_PAGES
Definition: advmon.c:10
#define ZeroMemory
Definition: winbase.h:1635
HINSTANCE hApplet
Definition: access.c:17
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CreatePropertySheetPage
Definition: prsht.h:381
#define PSP_DEFAULT
Definition: prsht.h:22
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: advmon.c:13
LPARAM lParam
Definition: combotst.c:139
DLGPROC DlgProc
Definition: desk.c:110
#define PROPSHEETPAGE
Definition: prsht.h:371

Referenced by DisplayAdvancedSettings().

◆ PropSheetAddPage()

static BOOL CALLBACK PropSheetAddPage ( HPROPSHEETPAGE  hpage,
LPARAM  lParam 
)
static

Definition at line 13 of file advmon.c.

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 }
#define TRUE
Definition: types.h:120
#define MAX_ADVANCED_PAGES
Definition: advmon.c:10
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:374
LPARAM lParam
Definition: combotst.c:139

Referenced by DisplayAdvancedSettings(), DisplayAdvancedSettingsInitPropSheetPage(), KeyboardApplet(), and MouseApplet().