ReactOS 0.4.15-dev-8344-g0574987
deskcplx.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DESK_EXT_INTERFACE
 

Macros

#define DESK_EXT_CALLBACK   CALLBACK
 
#define DESK_EXT_EXTINTERFACE   TEXT("Desk.cpl extension interface")
 
#define DESK_EXT_PRUNINGMODE   TEXT("Pruning Mode")
 
#define DESK_EXT_DISPLAYDEVICE   TEXT("Display Device")
 
#define DESK_EXT_DISPLAYNAME   TEXT("Display Name")
 
#define DESK_EXT_DISPLAYID   TEXT("Display ID")
 
#define DESK_EXT_DISPLAYKEY   TEXT("Display Key")
 
#define DESK_EXT_DISPLAYSTATEFLAGS   TEXT("Display State Flags")
 
#define DESK_EXT_MONITORNAME   TEXT("Monitor Name")
 
#define DESK_EXT_MONITORDEVICE   TEXT("Monitor Device")
 

Typedefs

typedef PDEVMODEW(DESK_EXT_CALLBACKPDESK_EXT_ENUMALLMODES) (PVOID Context, DWORD Index)
 
typedef PDEVMODEW(DESK_EXT_CALLBACKPDESK_EXT_GETCURRENTMODE) (PVOID Context)
 
typedef BOOL(DESK_EXT_CALLBACKPDESK_EXT_SETCURRENTMODE) (PVOID Context, DEVMODEW *pDevMode)
 
typedef VOID(DESK_EXT_CALLBACKPDESK_EXT_GETPRUNINGMODE) (PVOID Context, PBOOL pbModesPruned, PBOOL pbKeyIsReadOnly, PBOOL pbPruningOn)
 
typedef VOID(DESK_EXT_CALLBACKPDESK_EXT_SETPRUNINGMODE) (PVOID Context, BOOL PruningOn)
 
typedef struct _DESK_EXT_INTERFACE DESK_EXT_INTERFACE
 
typedef struct _DESK_EXT_INTERFACEPDESK_EXT_INTERFACE
 

Functions

LONG WINAPI DisplaySaveSettings (PVOID pContext, HWND hwndPropSheet)
 
static __inline PDESK_EXT_INTERFACE QueryDeskCplExtInterface (IDataObject *pdo)
 
static __inline LPTSTR QueryDeskCplString (IDataObject *pdo, UINT cfFormat)
 
static __inline LONG DeskCplExtDisplaySaveSettings (PDESK_EXT_INTERFACE DeskExtInterface, HWND hwndDlg)
 

Macro Definition Documentation

◆ DESK_EXT_CALLBACK

#define DESK_EXT_CALLBACK   CALLBACK

Definition at line 4 of file deskcplx.h.

◆ DESK_EXT_DISPLAYDEVICE

#define DESK_EXT_DISPLAYDEVICE   TEXT("Display Device")

Definition at line 8 of file deskcplx.h.

◆ DESK_EXT_DISPLAYID

#define DESK_EXT_DISPLAYID   TEXT("Display ID")

Definition at line 10 of file deskcplx.h.

◆ DESK_EXT_DISPLAYKEY

#define DESK_EXT_DISPLAYKEY   TEXT("Display Key")

Definition at line 11 of file deskcplx.h.

◆ DESK_EXT_DISPLAYNAME

#define DESK_EXT_DISPLAYNAME   TEXT("Display Name")

Definition at line 9 of file deskcplx.h.

◆ DESK_EXT_DISPLAYSTATEFLAGS

#define DESK_EXT_DISPLAYSTATEFLAGS   TEXT("Display State Flags")

Definition at line 12 of file deskcplx.h.

◆ DESK_EXT_EXTINTERFACE

#define DESK_EXT_EXTINTERFACE   TEXT("Desk.cpl extension interface")

Definition at line 6 of file deskcplx.h.

◆ DESK_EXT_MONITORDEVICE

#define DESK_EXT_MONITORDEVICE   TEXT("Monitor Device")

Definition at line 14 of file deskcplx.h.

◆ DESK_EXT_MONITORNAME

#define DESK_EXT_MONITORNAME   TEXT("Monitor Name")

Definition at line 13 of file deskcplx.h.

◆ DESK_EXT_PRUNINGMODE

#define DESK_EXT_PRUNINGMODE   TEXT("Pruning Mode")

Definition at line 7 of file deskcplx.h.

Typedef Documentation

◆ DESK_EXT_INTERFACE

◆ PDESK_EXT_ENUMALLMODES

typedef PDEVMODEW(DESK_EXT_CALLBACK * PDESK_EXT_ENUMALLMODES) (PVOID Context, DWORD Index)

Definition at line 16 of file deskcplx.h.

◆ PDESK_EXT_GETCURRENTMODE

typedef PDEVMODEW(DESK_EXT_CALLBACK * PDESK_EXT_GETCURRENTMODE) (PVOID Context)

Definition at line 17 of file deskcplx.h.

◆ PDESK_EXT_GETPRUNINGMODE

typedef VOID(DESK_EXT_CALLBACK * PDESK_EXT_GETPRUNINGMODE) (PVOID Context, PBOOL pbModesPruned, PBOOL pbKeyIsReadOnly, PBOOL pbPruningOn)

Definition at line 19 of file deskcplx.h.

◆ PDESK_EXT_INTERFACE

◆ PDESK_EXT_SETCURRENTMODE

typedef BOOL(DESK_EXT_CALLBACK * PDESK_EXT_SETCURRENTMODE) (PVOID Context, DEVMODEW *pDevMode)

Definition at line 18 of file deskcplx.h.

◆ PDESK_EXT_SETPRUNINGMODE

typedef VOID(DESK_EXT_CALLBACK * PDESK_EXT_SETPRUNINGMODE) (PVOID Context, BOOL PruningOn)

Definition at line 20 of file deskcplx.h.

Function Documentation

◆ DeskCplExtDisplaySaveSettings()

static __inline LONG DeskCplExtDisplaySaveSettings ( PDESK_EXT_INTERFACE  DeskExtInterface,
HWND  hwndDlg 
)
static

Definition at line 122 of file deskcplx.h.

124{
125 typedef LONG (WINAPI *PDISPLAYSAVESETTINGS)(PVOID, HWND);
126 HMODULE hModDeskCpl;
127 PDISPLAYSAVESETTINGS pDisplaySaveSettings;
129
130 /* We could use GetModuleHandle() instead, but then this routine
131 wouldn't work if some other application hosts the shell extension */
132 hModDeskCpl = LoadLibrary(TEXT("desk.cpl"));
133 if (hModDeskCpl != NULL)
134 {
135 pDisplaySaveSettings = (PDISPLAYSAVESETTINGS)GetProcAddress(hModDeskCpl,
136 "DisplaySaveSettings");
137 if (pDisplaySaveSettings != NULL)
138 {
139 lRet = pDisplaySaveSettings(DeskExtInterface->Context,
140 hwndDlg);
141 }
142
143 FreeLibrary(hModDeskCpl);
144 }
145
146 return lRet;
147}
#define NULL
Definition: types.h:112
HANDLE HWND
Definition: compat.h:19
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define TEXT(s)
Definition: k32.h:26
long LONG
Definition: pedump.c:60
void * PVOID
Definition: typedefs.h:50
#define LoadLibrary
Definition: winbase.h:3862
#define WINAPI
Definition: msvc.h:6
#define DISP_CHANGE_BADPARAM
Definition: winuser.h:193

Referenced by ApplyDisplayAdapterChanges(), and ApplyMonitorChanges().

◆ DisplaySaveSettings()

LONG WINAPI DisplaySaveSettings ( PVOID  pContext,
HWND  hwndPropSheet 
)

Definition at line 1070 of file devsett.c.

1072{
1075
1076 if (This->lpCurDevMode != This->lpOrigDevMode)
1077 {
1078 SETTINGS_ENTRY seOrig, seCur;
1079 BOOL Ret;
1080
1081 seOrig.dmPelsWidth = This->lpOrigDevMode->dmPelsWidth;
1082 seOrig.dmPelsHeight = This->lpOrigDevMode->dmPelsHeight;
1083 seOrig.dmBitsPerPel = This->lpOrigDevMode->dmBitsPerPel;
1084 seOrig.dmDisplayFrequency = This->lpOrigDevMode->dmDisplayFrequency;
1085
1086 seCur.dmPelsWidth = This->lpCurDevMode->dmPelsWidth;
1087 seCur.dmPelsHeight = This->lpCurDevMode->dmPelsHeight;
1088 seCur.dmBitsPerPel = This->lpCurDevMode->dmBitsPerPel;
1089 seCur.dmDisplayFrequency = This->lpCurDevMode->dmDisplayFrequency;
1090
1091 Ret = SwitchDisplayMode(hwndPropSheet,
1092 This->pDisplayDevice,
1093 &seOrig,
1094 &seCur,
1095 &rc);
1096
1097 if (rc == DISP_CHANGE_SUCCESSFUL)
1098 {
1099 if (Ret)
1100 This->lpOrigDevMode = This->lpCurDevMode;
1101 else
1102 This->lpCurDevMode = This->lpOrigDevMode;
1103 }
1104 }
1105
1106 return rc;
1107}
BOOL SwitchDisplayMode(HWND hwndDlg, PWSTR DeviceName, PSETTINGS_ENTRY seInit, PSETTINGS_ENTRY seNew, OUT PLONG rc)
Definition: settings.c:771
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:62
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: precomp.h:59
DWORD dmPelsHeight
Definition: precomp.h:64
DWORD dmDisplayFrequency
Definition: desk.h:138
DWORD dmBitsPerPel
Definition: precomp.h:62
DWORD dmPelsWidth
Definition: precomp.h:63
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190

◆ QueryDeskCplExtInterface()

static __inline PDESK_EXT_INTERFACE QueryDeskCplExtInterface ( IDataObject pdo)
static

Definition at line 48 of file deskcplx.h.

49{
50 PDESK_EXT_INTERFACE pRecvBuffer, pExtIface = NULL;
51 FORMATETC fetc;
52 STGMEDIUM medium;
53
54 fetc.cfFormat = (CLIPFORMAT)RegisterClipboardFormat(DESK_EXT_EXTINTERFACE);
55 fetc.ptd = NULL;
56 fetc.dwAspect = DVASPECT_CONTENT;
57 fetc.lindex = -1;
58 fetc.tymed = TYMED_HGLOBAL;
59
60 if (SUCCEEDED(IDataObject_GetData(pdo, &fetc, &medium)) && medium.hGlobal != NULL)
61 {
62 /* We always receive the string in unicode! */
63 pRecvBuffer = (PDESK_EXT_INTERFACE)GlobalLock(medium.hGlobal);
64
65 if (pRecvBuffer->cbSize == sizeof(*pRecvBuffer))
66 {
67 pExtIface = LocalAlloc(LMEM_FIXED, sizeof(*pExtIface));
68 if (pExtIface != NULL)
69 {
70 CopyMemory(pExtIface,
71 pRecvBuffer,
72 sizeof(*pRecvBuffer));
73 }
74 }
75
76 GlobalUnlock(medium.hGlobal);
77 ReleaseStgMedium(&medium);
78 }
79
80 return pExtIface;
81}
struct _DESK_EXT_INTERFACE * PDESK_EXT_INTERFACE
#define DESK_EXT_EXTINTERFACE
Definition: deskcplx.h:6
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define CopyMemory
Definition: winbase.h:1710
#define LMEM_FIXED
Definition: winbase.h:368
#define RegisterClipboardFormat
Definition: winuser.h:5847

Referenced by IDeskDisplayAdapter_Initialize(), and IDeskMonitor_Initialize().

◆ QueryDeskCplString()

static __inline LPTSTR QueryDeskCplString ( IDataObject pdo,
UINT  cfFormat 
)
static

Definition at line 84 of file deskcplx.h.

85{
86 FORMATETC fetc;
87 STGMEDIUM medium;
89 LPWSTR lpRecvBuffer;
90 LPTSTR lpStr = NULL;
91
92 fetc.cfFormat = (CLIPFORMAT)cfFormat;
93 fetc.ptd = NULL;
94 fetc.dwAspect = DVASPECT_CONTENT;
95 fetc.lindex = -1;
96 fetc.tymed = TYMED_HGLOBAL;
97
98 if (SUCCEEDED(IDataObject_GetData(pdo, &fetc, &medium)) && medium.hGlobal != NULL)
99 {
100 /* We always receive the string in unicode! */
101 lpRecvBuffer = (LPWSTR)GlobalLock(medium.hGlobal);
102
103 BufLen = wcslen(lpRecvBuffer) + 1;
104 lpStr = LocalAlloc(LMEM_FIXED, BufLen * sizeof(TCHAR));
105 if (lpStr != NULL)
106 {
107#ifdef UNICODE
108 wcscpy(lpStr, lpRecvBuffer);
109#else
110 WideCharToMultiByte(CP_ACP, 0, lpRecvBuffer, -1, lpStr, BufLen, NULL, NULL);
111#endif
112 }
113
114 GlobalUnlock(medium.hGlobal);
115 ReleaseStgMedium(&medium);
116 }
117
118 return lpStr;
119}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define BufLen
Definition: fatfs.h:167
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
ULONG_PTR SIZE_T
Definition: typedefs.h:80
char TCHAR
Definition: xmlstorage.h:189
WCHAR * LPWSTR
Definition: xmlstorage.h:184
CHAR * LPTSTR
Definition: xmlstorage.h:192

Referenced by BuildAdvPropTitle(), InitDisplayAdapterDialog(), and InitMonitorDialog().