ReactOS  0.4.15-dev-980-ge160524
alarms.c File Reference
#include "powercfg.h"
Include dependency graph for alarms.c:

Go to the source code of this file.

Functions

static BOOLEAN Ala_InitData (HWND hwndDlg)
 
INT_PTR CALLBACK AlarmsDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ Ala_InitData()

static BOOLEAN Ala_InitData ( HWND  hwndDlg)
static

Definition at line 15 of file alarms.c.

16 {
17  TCHAR szAction[MAX_PATH];
19  TCHAR szSound[MAX_PATH];
20  TCHAR szMessage[MAX_PATH];
21  TCHAR szTemp[MAX_PATH];
22  TCHAR szBatteryLevel[MAX_PATH];
23  TCHAR szProgram[MAX_PATH];
24 
26  {
27  return FALSE;
28  }
29 
31  {
32  CheckDlgButton(hwndDlg, IDC_ALARM1,
34 
35  if (LoadString(hApplet, IDS_PERCENT, szTemp, MAX_PATH))
36  {
38  SetDlgItemText(hwndDlg, IDC_ALARMVALUE1, szBatteryLevel);
39  }
40 
43  (WPARAM)TRUE,
44  (LPARAM)MAKELONG(0, 100));
47  (WPARAM)TRUE,
48  (LPARAM)20);
50  TBM_SETPOS,
51  (WPARAM)TRUE,
53 
55  {
56  SetDlgItemText(hwndDlg, IDC_ALARMAKTION1, szAction);
57  }
58 
59  memset(szMessage, 0x0, sizeof(szMessage));
61 
63  {
65  {
67  {
68  _stprintf(szMessage,_T("%s, %s"),szSound,szText);
69  }
70  }
71  else
72  {
74  {
75  _stprintf(szMessage,_T("%s"),szText);
76  }
77  }
78  }
79  else
80  {
82  {
83  if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH))
84  {
85  _stprintf(szMessage,_T("%s"),szSound);
86  }
87  }
88  }
89 
90  SetDlgItemText(hwndDlg, IDC_ALARMMSG1, szMessage);
91 
93  {
94  SetDlgItemText(hwndDlg, IDC_ALARMPROG1, szProgram);
95  }
96  }
97 
99  {
100  CheckDlgButton(hwndDlg, IDC_ALARM2,
102 
103  if (LoadString(hApplet, IDS_PERCENT, szTemp, MAX_PATH))
104  {
106  SetDlgItemText(hwndDlg, IDC_ALARMVALUE2, szBatteryLevel);
107  }
108 
110  TBM_SETRANGE,
111  (WPARAM)TRUE,
112  (LPARAM)MAKELONG(0, 100));
114  TBM_SETPOS,
115  (WPARAM)TRUE,
117 
119  {
120  SetDlgItemText(hwndDlg, IDC_ALARMAKTION2, szAction);
121  }
122 
123  memset(szMessage, 0x0, sizeof(szMessage));
124  LoadString(hApplet, IDS_NOACTION, szMessage, MAX_PATH);
125 
127  {
129  {
131  {
132  _stprintf(szMessage,_T("%s, %s"),szSound,szText);
133  }
134  }
135  else
136  {
138  {
139  _stprintf(szMessage,_T("%s"),szText);
140  }
141  }
142  }
143  else
144  {
146  {
147  if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH))
148  {
149  _stprintf(szMessage,_T("%s"),szSound);
150  }
151  }
152  }
153 
154  SetDlgItemText(hwndDlg, IDC_ALARMMSG2, szMessage);
155 
157  {
158  SetDlgItemText(hwndDlg, IDC_ALARMPROG2, szProgram);
159  }
160  }
161 
162  return TRUE;
163 }
#define IDC_ALARMBAR1
Definition: resource.h:83
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDC_ALARMVALUE1
Definition: resource.h:85
GLint x0
Definition: linetemp.h:95
GLOBAL_USER_POWER_POLICY user
Definition: powrprof.h:42
#define TRUE
Definition: types.h:120
#define TBM_SETRANGE
Definition: commctrl.h:2033
#define TBM_SETPOS
Definition: commctrl.h:2032
HINSTANCE hApplet
Definition: access.c:17
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5817
POWER_ACTION_POLICY PowerPolicy
Definition: winnt_old.h:3800
#define FALSE
Definition: types.h:117
static const WCHAR szText[]
Definition: dialog.c:139
#define POWER_LEVEL_USER_NOTIFY_SOUND
Definition: ntpoapi.h:424
#define IDS_SOUND
Definition: resource.h:9
#define MAKELONG(a, b)
Definition: typedefs.h:249
POWER_ACTION Action
Definition: ntpoapi.h:408
LONG_PTR LPARAM
Definition: windef.h:208
#define TBM_SETTICFREQ
Definition: commctrl.h:2046
GLOBAL_POWER_POLICY gGPP
Definition: powercfg.c:23
#define IDC_ALARMMSG1
Definition: resource.h:82
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define IDC_ALARMAKTION1
Definition: resource.h:89
#define MAX_PATH
Definition: compat.h:34
#define IDS_NOACTION
Definition: resource.h:22
#define SetDlgItemText
Definition: winuser.h:5824
#define IDS_PowerActionNone2
Definition: resource.h:31
#define BST_UNCHECKED
Definition: winuser.h:199
#define IDS_PERCENT
Definition: resource.h:8
#define IDC_ALARMPROG1
Definition: resource.h:90
#define _stprintf
Definition: utility.h:124
SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES]
Definition: powrprof.h:38
BOOLEAN WINAPI ReadGlobalPwrPolicy(PGLOBAL_POWER_POLICY pGlobalPowerPolicy)
Definition: powrprof.c:521
#define BST_CHECKED
Definition: winuser.h:197
#define IDS_TEXT
Definition: resource.h:3
#define IDC_ALARMPROG2
Definition: resource.h:93
#define memset(x, y, z)
Definition: compat.h:39
#define DISCHARGE_POLICY_LOW
Definition: ntpoapi.h:431
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_ALARMAKTION2
Definition: resource.h:92
#define LoadString
Definition: winuser.h:5794
#define IDC_ALARM2
Definition: resource.h:88
#define POWER_LEVEL_USER_NOTIFY_TEXT
Definition: ntpoapi.h:423
#define IDC_ALARM1
Definition: resource.h:87
#define IDC_ALARMMSG2
Definition: resource.h:91
#define IDC_ALARMVALUE2
Definition: resource.h:86
#define DISCHARGE_POLICY_CRITICAL
Definition: ntpoapi.h:430
#define IDC_ALARMBAR2
Definition: resource.h:84
#define IDS_PowerActionNone1
Definition: resource.h:23

Referenced by AlarmsDlgProc().

◆ AlarmsDlgProc()

INT_PTR CALLBACK AlarmsDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 167 of file alarms.c.

171 {
174 
175  switch (uMsg)
176  {
177  case WM_INITDIALOG:
178  if (!Ala_InitData(hwndDlg))
179  {
180  // TODO:
181  // Handle initialization error
182  }
183  return TRUE;
184 
185  default:
186  break;
187  }
188 
189  return FALSE;
190 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static BOOLEAN Ala_InitData(HWND hwndDlg)
Definition: alarms.c:15
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139

Referenced by Applet1().