ReactOS 0.4.16-dev-1946-g52006dd
alarms.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Power Configuration Applet
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Alarms tab
5 * COPYRIGHT: Copyright 2006 Alexander Wurzinger <lohnegrim@gmx.net>
6 * Copyright 2006 Johannes Anderwald <johannes.anderwald@reactos.org>
7 * Copyright 2006 Martin Rottensteiner <2005only@pianonote.at>
8 */
9
10#include "powercfg.h"
11
12static BOOLEAN
14{
15 TCHAR szAction[MAX_PATH];
16 TCHAR szText[MAX_PATH];
17 TCHAR szSound[MAX_PATH];
18 TCHAR szMessage[MAX_PATH];
19 TCHAR szTemp[MAX_PATH];
20 TCHAR szBatteryLevel[MAX_PATH];
21 TCHAR szProgram[MAX_PATH];
22
24 return FALSE;
25
27 {
30
31 if (LoadString(hApplet, IDS_PERCENT, szTemp, _countof(szTemp)))
32 {
34 SetDlgItemText(hwndDlg, IDC_ALARMVALUE1, szBatteryLevel);
35 }
36
39 (WPARAM)TRUE,
40 (LPARAM)MAKELONG(0, 100));
43 (WPARAM)TRUE,
44 (LPARAM)20);
47 (WPARAM)TRUE,
49
51 {
52 SetDlgItemText(hwndDlg, IDC_ALARMAKTION1, szAction);
53 }
54
55 ZeroMemory(szMessage, sizeof(szMessage));
56 LoadString(hApplet, IDS_NOACTION, szMessage, _countof(szMessage));
57
59 {
61 {
62 if (LoadString(hApplet, IDS_SOUND, szSound, _countof(szSound)) && LoadString(hApplet, IDS_TEXT, szText, _countof(szText)))
63 _stprintf(szMessage, _T("%s, %s"), szSound, szText);
64 }
65 else
66 {
67 if (LoadString(hApplet, IDS_TEXT, szText, _countof(szText)))
68 _stprintf(szMessage, _T("%s"), szText);
69 }
70 }
71 else
72 {
74 {
75 if (LoadString(hApplet, IDS_SOUND, szSound, _countof(szSound)))
76 _stprintf(szMessage, _T("%s"), szSound);
77 }
78 }
79
80 SetDlgItemText(hwndDlg, IDC_ALARMMSG1, szMessage);
81
82 if (LoadString(hApplet, IDS_PowerActionNone2, szProgram, _countof(szProgram)))
83 {
84 SetDlgItemText(hwndDlg, IDC_ALARMPROG1, szProgram);
85 }
86 }
87
89 {
92
93 if (LoadString(hApplet, IDS_PERCENT, szTemp, _countof(szTemp)))
94 {
96 SetDlgItemText(hwndDlg, IDC_ALARMVALUE2, szBatteryLevel);
97 }
98
101 (WPARAM)TRUE,
102 (LPARAM)MAKELONG(0, 100));
105 (WPARAM)TRUE,
107
109 {
110 SetDlgItemText(hwndDlg, IDC_ALARMAKTION2, szAction);
111 }
112
113 ZeroMemory(szMessage, sizeof(szMessage));
114 LoadString(hApplet, IDS_NOACTION, szMessage, _countof(szMessage));
115
117 {
119 {
120 if (LoadString(hApplet, IDS_TEXT, szText, _countof(szText)) && LoadString(hApplet, IDS_SOUND, szSound, _countof(szSound)))
121 _stprintf(szMessage, _T("%s, %s"), szSound, szText);
122 }
123 else
124 {
125 if (LoadString(hApplet, IDS_TEXT, szText, _countof(szText)))
126 _stprintf(szMessage, _T("%s"), szText);
127 }
128 }
129 else
130 {
132 {
133 if (LoadString(hApplet, IDS_SOUND, szSound, _countof(szSound)))
134 _stprintf(szMessage, _T("%s"), szSound);
135 }
136 }
137
138 SetDlgItemText(hwndDlg, IDC_ALARMMSG2, szMessage);
139
140 if (LoadString(hApplet, IDS_PowerActionNone2, szProgram, _countof(szProgram)))
141 {
142 SetDlgItemText(hwndDlg, IDC_ALARMPROG2, szProgram);
143 }
144 }
145
146 return TRUE;
147}
148
149/* Property page dialog callback */
152 UINT uMsg,
155{
158
159 switch (uMsg)
160 {
161 case WM_INITDIALOG:
162 if (!Ala_InitData(hwndDlg))
163 {
164 // TODO:
165 // Handle initialization error
166 }
167 return TRUE;
168
169 default:
170 break;
171 }
172
173 return FALSE;
174}
unsigned char BOOLEAN
INT_PTR CALLBACK AlarmsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: alarms.c:151
static BOOLEAN Ala_InitData(HWND hwndDlg)
Definition: alarms.c:13
#define IDS_TEXT
Definition: resource.h:3
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define IDC_ALARMAKTION1
Definition: resource.h:132
#define IDS_SOUND
Definition: resource.h:48
#define IDC_ALARMVALUE2
Definition: resource.h:129
#define IDS_PERCENT
Definition: resource.h:47
#define IDC_ALARMAKTION2
Definition: resource.h:135
#define IDC_ALARMBAR2
Definition: resource.h:127
#define IDC_ALARM2
Definition: resource.h:131
#define IDC_ALARMPROG2
Definition: resource.h:136
#define IDS_NOACTION
Definition: resource.h:62
#define IDC_ALARMPROG1
Definition: resource.h:133
#define IDC_ALARMMSG1
Definition: resource.h:125
#define IDS_PowerActionNone1
Definition: resource.h:63
#define IDC_ALARMVALUE1
Definition: resource.h:128
#define IDC_ALARM1
Definition: resource.h:130
#define IDC_ALARMBAR1
Definition: resource.h:126
#define IDC_ALARMMSG2
Definition: resource.h:134
#define IDS_PowerActionNone2
Definition: resource.h:71
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
#define _stprintf
Definition: utility.h:124
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define POWER_LEVEL_USER_NOTIFY_SOUND
Definition: ntpoapi.h:425
#define DISCHARGE_POLICY_CRITICAL
Definition: ntpoapi.h:431
#define DISCHARGE_POLICY_LOW
Definition: ntpoapi.h:432
#define POWER_LEVEL_USER_NOTIFY_TEXT
Definition: ntpoapi.h:424
#define LOWORD(l)
Definition: pedump.c:82
GLOBAL_POWER_POLICY gGPP
Definition: powercfg.c:16
BOOLEAN WINAPI ReadGlobalPwrPolicy(PGLOBAL_POWER_POLICY pGlobalPowerPolicy)
Definition: powrprof.c:857
#define TBM_SETRANGE
Definition: commctrl.h:2042
#define TBM_SETPOS
Definition: commctrl.h:2041
#define TBM_SETTICFREQ
Definition: commctrl.h:2055
#define _countof(array)
Definition: sndvol32.h:70
GLOBAL_USER_POWER_POLICY user
Definition: powrprof.h:60
SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES]
Definition: powrprof.h:54
POWER_ACTION Action
Definition: ntpoapi.h:409
POWER_ACTION_POLICY PowerPolicy
Definition: winnt_old.h:4169
int32_t INT_PTR
Definition: typedefs.h:64
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define _T(x)
Definition: vfdio.h:22
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
#define WM_INITDIALOG
Definition: winuser.h:1767
#define LoadString
Definition: winuser.h:5930
#define SendDlgItemMessage
Definition: winuser.h:5953
#define SetDlgItemText
Definition: winuser.h:5960
#define BST_CHECKED
Definition: winuser.h:197
char TCHAR
Definition: xmlstorage.h:189