ReactOS 0.4.17-dev-243-g1369312
performance.c File Reference
#include "precomp.h"
#include <shlguid_undoc.h>
#include <shlobj_undoc.h>
#include <shlwapi_undoc.h>
Include dependency graph for performance.c:

Go to the source code of this file.

Functions

static VOID RegTreeOpt_OnDestroy (IRegTreeOptions *pRTO)
 
static BOOL RegTreeOpt_ToggleCheckItem (IRegTreeOptions *pRTO, HTREEITEM hItem)
 
static BOOL RegTreeOpt_OnTreeViewClick (IRegTreeOptions *pRTO, HWND hWndTree)
 
static BOOL RegTreeOpt_OnTreeViewKeyDown (IRegTreeOptions *pRTO, HWND hWndTree, TV_KEYDOWN *pKey)
 
static INT_PTR CALLBACK VisualEffectsDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK AdvancedDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID ShowPerformanceOptions (HWND hDlg)
 

Function Documentation

◆ AdvancedDlgProc()

static INT_PTR CALLBACK AdvancedDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 115 of file performance.c.

116{
117 switch (uMsg)
118 {
119 case WM_INITDIALOG:
120 // TODO: Not implemented yet
123 return TRUE;
124
125 case WM_COMMAND:
126 switch (LOWORD(wParam))
127 {
128 case IDC_CHANGESWAP:
130 break;
131 }
132 break;
133 }
134 return FALSE;
135}
WPARAM wParam
Definition: combotst.c:138
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
INT_PTR CALLBACK VirtMemDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: virtmem.c:821
#define IDC_CPUCLIENT
Definition: resource.h:163
#define IDC_CPUSERVER
Definition: resource.h:164
#define IDD_VIRTMEM
Definition: resource.h:168
#define IDC_CHANGESWAP
Definition: resource.h:165
#define LOWORD(l)
Definition: pedump.c:82
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4553
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_INITDIALOG
Definition: winuser.h:1767
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by ShowPerformanceOptions().

◆ RegTreeOpt_OnDestroy()

static VOID RegTreeOpt_OnDestroy ( IRegTreeOptions *  pRTO)
static

Definition at line 16 of file performance.c.

17{
18 if (pRTO)
19 {
20 IRegTreeOptions_WalkTree(pRTO, WALK_TREE_DESTROY);
21 IRegTreeOptions_Release(pRTO);
22 }
23}
@ WALK_TREE_DESTROY
Definition: shlobj_undoc.h:516

Referenced by VisualEffectsDlgProc().

◆ RegTreeOpt_OnTreeViewClick()

static BOOL RegTreeOpt_OnTreeViewClick ( IRegTreeOptions *  pRTO,
HWND  hWndTree 
)
static

Definition at line 32 of file performance.c.

33{
34 TV_HITTESTINFO HitTest;
35 DWORD dwPos = GetMessagePos();
36 HitTest.pt.x = GET_X_LPARAM(dwPos);
37 HitTest.pt.y = GET_Y_LPARAM(dwPos);
38 ScreenToClient(hWndTree, &HitTest.pt);
39 HTREEITEM hItem = TreeView_HitTest(hWndTree, &HitTest);
41}
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL RegTreeOpt_ToggleCheckItem(IRegTreeOptions *pRTO, HTREEITEM hItem)
Definition: performance.c:26
#define TV_HITTESTINFO
Definition: commctrl.h:3521
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3518
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by VisualEffectsDlgProc().

◆ RegTreeOpt_OnTreeViewKeyDown()

static BOOL RegTreeOpt_OnTreeViewKeyDown ( IRegTreeOptions *  pRTO,
HWND  hWndTree,
TV_KEYDOWN pKey 
)
static

Definition at line 44 of file performance.c.

45{
46 if (pKey->wVKey == VK_SPACE)
48 else if (pKey->wVKey == VK_F5 && pRTO)
49 IRegTreeOptions_WalkTree(pRTO, WALK_TREE_REFRESH);
50 return FALSE;
51}
FxRegKey * pKey
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3478
@ WALK_TREE_REFRESH
Definition: shlobj_undoc.h:518
#define VK_SPACE
Definition: winuser.h:2255
#define VK_F5
Definition: winuser.h:2295

Referenced by VisualEffectsDlgProc().

◆ RegTreeOpt_ToggleCheckItem()

static BOOL RegTreeOpt_ToggleCheckItem ( IRegTreeOptions *  pRTO,
HTREEITEM  hItem 
)
static

Definition at line 26 of file performance.c.

27{
28 return pRTO && SUCCEEDED(IRegTreeOptions_ToggleItem(pRTO, hItem));
29}
#define SUCCEEDED(hr)
Definition: intsafe.h:50

Referenced by RegTreeOpt_OnTreeViewClick(), and RegTreeOpt_OnTreeViewKeyDown().

◆ ShowPerformanceOptions()

VOID ShowPerformanceOptions ( HWND  hDlg)

Definition at line 138 of file performance.c.

139{
140 HRESULT hrInit = CoInitialize(NULL); // For IRegTreeOptions
141 PROPSHEETHEADERW psh = { sizeof(psh), PSH_PROPSHEETPAGE | PSH_NOCONTEXTHELP };
142 PROPSHEETPAGEW pages[2] = { 0 };
143
144 pages[0].dwSize = sizeof(*pages);
145 pages[0].hInstance = hApplet;
148
149 pages[1].dwSize = sizeof(*pages);
150 pages[1].hInstance = hApplet;
152 pages[1].pfnDlgProc = AdvancedDlgProc;
153
154 psh.hwndParent = hDlg;
155 psh.hInstance = hApplet;
157 psh.nPages = _countof(pages);
158 psh.ppsp = pages;
159
160 PropertySheetW(&psh);
161
162 if (SUCCEEDED(hrInit))
164}
#define NULL
Definition: types.h:112
#define IDS_PERFORMANCEOPTIONS
Definition: resource.h:17
#define IDD_VISUALEFFECTS
Definition: resource.h:158
#define IDD_ADVANCEDPERF
Definition: resource.h:162
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
static INT_PTR CALLBACK VisualEffectsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: performance.c:54
static INT_PTR CALLBACK AdvancedDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: performance.c:115
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define _countof(array)
Definition: sndvol32.h:70
LPCPROPSHEETPAGEW ppsp
Definition: prsht.h:308
HINSTANCE hInstance
Definition: prsht.h:296
HWND hwndParent
Definition: prsht.h:295
LPCWSTR pszCaption
Definition: prsht.h:301
DLGPROC pfnDlgProc
Definition: prsht.h:226
DWORD dwSize
Definition: prsht.h:214
LPCWSTR pszTemplate
Definition: prsht.h:218
HINSTANCE hInstance
Definition: prsht.h:216

Referenced by AdvancedPageProc(), and SystemApplet().

◆ VisualEffectsDlgProc()

static INT_PTR CALLBACK VisualEffectsDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 54 of file performance.c.

55{
56 IRegTreeOptions *pRTO = (IRegTreeOptions*)GetWindowLongPtrW(hDlg, DWLP_USER);
57 HWND hWndTree = GetDlgItem(hDlg, IDC_TREE);
58
59 switch (uMsg)
60 {
61 case WM_INITDIALOG:
62 {
63 IRegTreeOptions *pRTO = NULL;
64 if (SUCCEEDED(CoCreateInstance(&CLSID_CRegTreeOptions, NULL, CLSCTX_INPROC_SERVER,
65 &IID_IRegTreeOptions, (void**)&pRTO)))
66 {
67 LPCSTR pszPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VisualEffects";
69 IRegTreeOptions_InitTree(pRTO, hWndTree, HKEY_LOCAL_MACHINE, pszPath, NULL);
70 }
71 else
72 {
73 // Without IRegTreeOptions, our page is pointless so we remove it.
74 // MSDN says we have to post the remove message from inside WM_INITDIALOG.
75 HWND hWndPS = GetParent(hDlg);
76 int iPage = PropSheet_HwndToIndex(hWndPS, hDlg);
77 PostMessage(hWndPS, PSM_REMOVEPAGE, 0, SendMessageW(hWndPS, PSM_INDEXTOPAGE, iPage, 0));
78 }
79 return TRUE;
80 }
81
82 case WM_DESTROY:
85 break;
86
87 case WM_NOTIFY:
88 switch (((LPNMHDR)lParam)->code)
89 {
90 case NM_CLICK:
91 if (RegTreeOpt_OnTreeViewClick(pRTO, hWndTree))
92 PropSheet_Changed(GetParent(hDlg), hDlg);
93 break;
94
95 case TVN_KEYDOWN:
96 if (RegTreeOpt_OnTreeViewKeyDown(pRTO, hWndTree, (TV_KEYDOWN*)lParam))
97 PropSheet_Changed(GetParent(hDlg), hDlg);
98 break;
99
100 case PSN_APPLY:
101 {
102 if (pRTO)
103 IRegTreeOptions_WalkTree(pRTO, WALK_TREE_SAVE);
104
105 SHSendMessageBroadcastW(WM_SETTINGCHANGE, 0, 0); // For the ListviewShadow setting
106 return TRUE;
107 }
108 }
109 break;
110 }
111 return FALSE;
112}
LPARAM lParam
Definition: combotst.c:139
#define IDC_TREE
Definition: resource.h:159
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
DWORD WINAPI SHSendMessageBroadcastW(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ordinal.c:4195
LONG_PTR LPARAM
Definition: minwindef.h:175
static BOOL RegTreeOpt_OnTreeViewClick(IRegTreeOptions *pRTO, HWND hWndTree)
Definition: performance.c:32
static BOOL RegTreeOpt_OnTreeViewKeyDown(IRegTreeOptions *pRTO, HWND hWndTree, TV_KEYDOWN *pKey)
Definition: performance.c:44
static VOID RegTreeOpt_OnDestroy(IRegTreeOptions *pRTO)
Definition: performance.c:16
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSM_REMOVEPAGE
Definition: prsht.h:166
#define PSN_APPLY
Definition: prsht.h:117
#define TVN_KEYDOWN
Definition: commctrl.h:3718
#define NM_CLICK
Definition: commctrl.h:130
#define TV_KEYDOWN
Definition: commctrl.h:3727
#define WM_NOTIFY
Definition: richedit.h:61
@ WALK_TREE_SAVE
Definition: shlobj_undoc.h:515
Definition: inflate.c:139
const char * LPCSTR
Definition: typedefs.h:52
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define DWLP_USER
Definition: winuser.h:883
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define WM_SETTINGCHANGE
Definition: winuser.h:1657
#define PostMessage
Definition: winuser.h:5998
HWND WINAPI GetParent(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1637
#define SetWindowLongPtrW
Definition: winuser.h:5512
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ShowPerformanceOptions().