Author: rnaumann
Date: Mon Sep 7 21:56:38 2015
New Revision: 69102
URL:
http://svn.reactos.org/svn/reactos?rev=69102&view=rev
Log:
[powercfg] convert tabs to spaces. NFC
Modified:
trunk/reactos/dll/cpl/powercfg/advanced.c
trunk/reactos/dll/cpl/powercfg/alarms.c
trunk/reactos/dll/cpl/powercfg/hibernate.c
trunk/reactos/dll/cpl/powercfg/powercfg.c
trunk/reactos/dll/cpl/powercfg/powershemes.c
Modified: trunk/reactos/dll/cpl/powercfg/advanced.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/advanced.…
==============================================================================
--- trunk/reactos/dll/cpl/powercfg/advanced.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/powercfg/advanced.c [iso-8859-1] Mon Sep 7 21:56:38 2015
@@ -25,12 +25,12 @@
LRESULT Index;
if (LoadString(hApplet, ResourceId, szBuffer, MAX_PATH) < MAX_PATH)
{
- Index = SendMessage(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)szBuffer);
+ Index = SendMessage(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)szBuffer);
if (Index != CB_ERR)
- {
- SendMessage(hDlgCtrl, CB_SETITEMDATA, (WPARAM)Index, lParam);
- lpAction[Index] = (POWER_ACTION)lParam;
- }
+ {
+ SendMessage(hDlgCtrl, CB_SETITEMDATA, (WPARAM)Index, lParam);
+ lpAction[Index] = (POWER_ACTION)lParam;
+ }
}
}
@@ -41,8 +41,8 @@
for (Index = 0; Index < (INT)dwActionSize; Index++)
{
- if (lpAction[Index] == poAction)
- return Index;
+ if (lpAction[Index] == poAction)
+ return Index;
}
return -1;
@@ -51,65 +51,65 @@
static BOOLEAN
IsBatteryUsed(VOID)
{
- SYSTEM_BATTERY_STATE sbs;
-
- if (CallNtPowerInformation(SystemBatteryState,NULL, (ULONG)0, &sbs,
sizeof(SYSTEM_BATTERY_STATE)) == STATUS_SUCCESS)
- {
- if (sbs.BatteryPresent)
- {
- if (sbs.AcOnLine)
- {
- return FALSE;
- }
- return TRUE;
- }
- }
-
- return FALSE;
+ SYSTEM_BATTERY_STATE sbs;
+
+ if (CallNtPowerInformation(SystemBatteryState,NULL, (ULONG)0, &sbs,
sizeof(SYSTEM_BATTERY_STATE)) == STATUS_SUCCESS)
+ {
+ if (sbs.BatteryPresent)
+ {
+ if (sbs.AcOnLine)
+ {
+ return FALSE;
+ }
+ return TRUE;
+ }
+ }
+
+ return FALSE;
}
POWER_ACTION
GetPowerActionFromPolicy(POWER_ACTION_POLICY *Policy)
{
- POWER_ACTION poAction = PowerActionNone;
- /*
-
- TCHAR szBuffer[MAX_PATH];
-
- // Note: Windows XP SP2+ does not return the PowerAction code
- // for PowerActionWarmEject + PowerActionShutdown but sets it
- // to PowerActionNone and sets the Flags & EventCode
-
-
- _stprintf(szBuffer, L"Action: %x EventCode %x Flags %x",Policy->Action,
Policy->EventCode, Policy->Flags);
- MessageBoxW(NULL, szBuffer, NULL, MB_OK);
-
- */
-
- if (Policy->Action == PowerActionNone)
- {
- if (Policy->Flags == (POWER_ACTION_UI_ALLOWED | POWER_ACTION_QUERY_ALLOWED))
- {
- if (Policy->EventCode == POWER_FORCE_TRIGGER_RESET)
- {
- poAction = PowerActionNone;
- }
- else if (Policy->EventCode == POWER_USER_NOTIFY_BUTTON)
- {
- poAction = PowerActionWarmEject;
- }
- else if (Policy->EventCode == POWER_USER_NOTIFY_SHUTDOWN)
- {
- poAction = PowerActionShutdown;
- }
- }
- }
- else
- {
- poAction = Policy->Action;
- }
-
- return poAction;
+ POWER_ACTION poAction = PowerActionNone;
+ /*
+
+ TCHAR szBuffer[MAX_PATH];
+
+ // Note: Windows XP SP2+ does not return the PowerAction code
+ // for PowerActionWarmEject + PowerActionShutdown but sets it
+ // to PowerActionNone and sets the Flags & EventCode
+
+
+ _stprintf(szBuffer, L"Action: %x EventCode %x Flags %x",Policy->Action,
Policy->EventCode, Policy->Flags);
+ MessageBoxW(NULL, szBuffer, NULL, MB_OK);
+
+ */
+
+ if (Policy->Action == PowerActionNone)
+ {
+ if (Policy->Flags == (POWER_ACTION_UI_ALLOWED | POWER_ACTION_QUERY_ALLOWED))
+ {
+ if (Policy->EventCode == POWER_FORCE_TRIGGER_RESET)
+ {
+ poAction = PowerActionNone;
+ }
+ else if (Policy->EventCode == POWER_USER_NOTIFY_BUTTON)
+ {
+ poAction = PowerActionWarmEject;
+ }
+ else if (Policy->EventCode == POWER_USER_NOTIFY_SHUTDOWN)
+ {
+ poAction = PowerActionShutdown;
+ }
+ }
+ }
+ else
+ {
+ poAction = Policy->Action;
+ }
+
+ return poAction;
}
VOID
@@ -118,60 +118,60 @@
DWORD dwActionSize,
POWER_ACTION_POLICY *Policy)
{
- int poActionIndex;
- POWER_ACTION poAction;
-
- poAction = GetPowerActionFromPolicy(Policy);
- poActionIndex = FindActionIndex(lpAction, dwActionSize, poAction);
-
- if (poActionIndex < 0)
- {
- return;
- }
-
- SendMessage(hDlgCtrl, CB_SETCURSEL, (WPARAM)poActionIndex, (LPARAM)0);
+ int poActionIndex;
+ POWER_ACTION poAction;
+
+ poAction = GetPowerActionFromPolicy(Policy);
+ poActionIndex = FindActionIndex(lpAction, dwActionSize, poAction);
+
+ if (poActionIndex < 0)
+ {
+ return;
+ }
+
+ SendMessage(hDlgCtrl, CB_SETCURSEL, (WPARAM)poActionIndex, (LPARAM)0);
}
BOOLEAN
SaveCurrentPowerActionPolicy(IN HWND hDlgCtrl,
OUT POWER_ACTION_POLICY *Policy)
{
- LRESULT Index;
- LRESULT ItemData;
-
- Index = SendMessage(hDlgCtrl, CB_GETCURSEL, 0, 0);
- if (Index == CB_ERR)
- return FALSE;
-
- ItemData = SendMessage(hDlgCtrl, CB_GETITEMDATA, (WPARAM)Index, 0);
- if (ItemData == CB_ERR)
- return FALSE;
-
- switch(ItemData)
- {
- case PowerActionNone:
- Policy->Action = PowerActionNone;
- Policy->EventCode = POWER_FORCE_TRIGGER_RESET;
- break;
- case PowerActionWarmEject:
- Policy->Action = PowerActionNone;
- Policy->EventCode = POWER_USER_NOTIFY_BUTTON;
- break;
- case PowerActionShutdown:
- Policy->Action = PowerActionNone;
- Policy->EventCode = POWER_USER_NOTIFY_SHUTDOWN;
- break;
- case PowerActionSleep:
- case PowerActionHibernate:
- Policy->Action = (POWER_ACTION)ItemData;
- Policy->EventCode = 0;
- break;
- default:
- return FALSE;
- }
- Policy->Flags = (POWER_ACTION_UI_ALLOWED | POWER_ACTION_QUERY_ALLOWED);
-
- return TRUE;
+ LRESULT Index;
+ LRESULT ItemData;
+
+ Index = SendMessage(hDlgCtrl, CB_GETCURSEL, 0, 0);
+ if (Index == CB_ERR)
+ return FALSE;
+
+ ItemData = SendMessage(hDlgCtrl, CB_GETITEMDATA, (WPARAM)Index, 0);
+ if (ItemData == CB_ERR)
+ return FALSE;
+
+ switch(ItemData)
+ {
+ case PowerActionNone:
+ Policy->Action = PowerActionNone;
+ Policy->EventCode = POWER_FORCE_TRIGGER_RESET;
+ break;
+ case PowerActionWarmEject:
+ Policy->Action = PowerActionNone;
+ Policy->EventCode = POWER_USER_NOTIFY_BUTTON;
+ break;
+ case PowerActionShutdown:
+ Policy->Action = PowerActionNone;
+ Policy->EventCode = POWER_USER_NOTIFY_SHUTDOWN;
+ break;
+ case PowerActionSleep:
+ case PowerActionHibernate:
+ Policy->Action = (POWER_ACTION)ItemData;
+ Policy->EventCode = 0;
+ break;
+ default:
+ return FALSE;
+ }
+ Policy->Flags = (POWER_ACTION_UI_ALLOWED | POWER_ACTION_QUERY_ALLOWED);
+
+ return TRUE;
}
@@ -180,297 +180,297 @@
VOID
ShowCurrentPowerActionPolicies(HWND hwndDlg)
{
- TCHAR szAction[MAX_PATH];
-
- if (!IsBatteryUsed())
- {
+ TCHAR szAction[MAX_PATH];
+
+ if (!IsBatteryUsed())
+ {
#if 0
- /* expiremental code */
-// ShowCurrentPowerButtonAcAction(hList2,
- ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
- g_SystemBatteries,
- sizeof(g_SystemBatteries) / sizeof(POWER_ACTION),
- &gGPP.user.LidCloseAc);
+ /* expiremental code */
+// ShowCurrentPowerButtonAcAction(hList2,
+ ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
+ g_SystemBatteries,
+ sizeof(g_SystemBatteries) / sizeof(POWER_ACTION),
+ &gGPP.user.LidCloseAc);
#else
- if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.LidCloseAc.Action, szAction,
MAX_PATH))
- {
- SendDlgItemMessage(hwndDlg, IDC_LIDCLOSE,
- CB_SELECTSTRING,
- TRUE,
- (LPARAM)szAction);
- }
+ if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.LidCloseAc.Action,
szAction, MAX_PATH))
+ {
+ SendDlgItemMessage(hwndDlg, IDC_LIDCLOSE,
+ CB_SELECTSTRING,
+ TRUE,
+ (LPARAM)szAction);
+ }
#endif
- ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
- g_PowerButton,
- sizeof(g_PowerButton) / sizeof(POWER_ACTION),
- &gGPP.user.PowerButtonAc);
+ ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
+ g_PowerButton,
+ sizeof(g_PowerButton) / sizeof(POWER_ACTION),
+ &gGPP.user.PowerButtonAc);
#if 0
- /* expiremental code */
- ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON),
- g_SleepButton,
- sizeof(g_SleepButton) / sizeof(POWER_ACTION),
- &gGPP.user.SleepButtonAc);
+ /* expiremental code */
+ ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON),
+ g_SleepButton,
+ sizeof(g_SleepButton) / sizeof(POWER_ACTION),
+ &gGPP.user.SleepButtonAc);
#else
- if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.SleepButtonAc.Action, szAction,
MAX_PATH))
- {
- SendDlgItemMessage(hwndDlg, IDC_SLEEPBUTTON,
- CB_SELECTSTRING,
- TRUE,
- (LPARAM)szAction);
- }
+ if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.SleepButtonAc.Action,
szAction, MAX_PATH))
+ {
+ SendDlgItemMessage(hwndDlg, IDC_SLEEPBUTTON,
+ CB_SELECTSTRING,
+ TRUE,
+ (LPARAM)szAction);
+ }
#endif
- }
- else
- {
+ }
+ else
+ {
#if 0
- ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE),
- g_SleepButton,
- sizeof(g_SleepButton) / sizeof(POWER_ACTION),
- &gGPP.user.LidCloseDc);
-
- ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
- g_SleepButton,
- sizeof(g_SleepButton) / sizeof(POWER_ACTION),
- &gGPP.user.PowerButtonDc);
-
- ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON),
- g_SleepButton,
- sizeof(g_SleepButton) / sizeof(POWER_ACTION),
- &gGPP.user.SleepButtonDc);
+ ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE),
+ g_SleepButton,
+ sizeof(g_SleepButton) / sizeof(POWER_ACTION),
+ &gGPP.user.LidCloseDc);
+
+ ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
+ g_SleepButton,
+ sizeof(g_SleepButton) / sizeof(POWER_ACTION),
+ &gGPP.user.PowerButtonDc);
+
+ ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON),
+ g_SleepButton,
+ sizeof(g_SleepButton) / sizeof(POWER_ACTION),
+ &gGPP.user.SleepButtonDc);
#else
- if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.LidCloseDc.Action, szAction,
MAX_PATH))
- {
- SendDlgItemMessage(hwndDlg, IDC_LIDCLOSE,
- CB_SELECTSTRING,
- TRUE,
- (LPARAM)szAction);
- }
- if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.PowerButtonDc.Action, szAction,
MAX_PATH))
- {
- SendDlgItemMessage(hwndDlg, IDC_POWERBUTTON,
- CB_SELECTSTRING,
- TRUE,
- (LPARAM)szAction);
- }
- if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.SleepButtonDc.Action, szAction,
MAX_PATH))
- {
- SendDlgItemMessage(hwndDlg, IDC_SLEEPBUTTON,
- CB_SELECTSTRING,
- TRUE,
- (LPARAM)szAction);
- }
+ if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.LidCloseDc.Action,
szAction, MAX_PATH))
+ {
+ SendDlgItemMessage(hwndDlg, IDC_LIDCLOSE,
+ CB_SELECTSTRING,
+ TRUE,
+ (LPARAM)szAction);
+ }
+ if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.PowerButtonDc.Action,
szAction, MAX_PATH))
+ {
+ SendDlgItemMessage(hwndDlg, IDC_POWERBUTTON,
+ CB_SELECTSTRING,
+ TRUE,
+ (LPARAM)szAction);
+ }
+ if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.SleepButtonDc.Action,
szAction, MAX_PATH))
+ {
+ SendDlgItemMessage(hwndDlg, IDC_SLEEPBUTTON,
+ CB_SELECTSTRING,
+ TRUE,
+ (LPARAM)szAction);
+ }
#endif
- }
+ }
}
VOID
Adv_InitDialog(VOID)
{
- HWND hList1;
- HWND hList2;
- HWND hList3;
-
- BOOLEAN bSuspend = FALSE;
- BOOLEAN bHibernate;
- BOOLEAN bShutdown;
-
- SYSTEM_POWER_CAPABILITIES spc;
-
- CheckDlgButton(hAdv,
- IDC_SYSTRAYBATTERYMETER,
- gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hAdv,
- IDC_PASSWORDLOGON,
- gGPP.user.GlobalFlags & EnablePasswordLogon ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hAdv,
- IDC_VIDEODIMDISPLAY,
- gGPP.user.GlobalFlags & EnableVideoDimDisplay ? BST_CHECKED : BST_UNCHECKED);
-
- GetPwrCapabilities(&spc);
-
- if (spc.SystemS1 || spc.SystemS2 || spc.SystemS3)
- bSuspend=TRUE;
-
- bHibernate = spc.HiberFilePresent;
- bShutdown = spc.SystemS5;
-
- hList1 = GetDlgItem(hAdv, IDC_LIDCLOSE);
- SendMessage(hList1, CB_RESETCONTENT, 0, 0);
-
- memset(g_SystemBatteries, 0x0, sizeof(g_SystemBatteries));
- if (spc.SystemBatteriesPresent)
- {
- AddItem(hList1, IDS_PowerActionNone1, (LPARAM)PowerActionNone, g_SystemBatteries);
-
- if (bSuspend)
- {
- AddItem(hList1, IDS_PowerActionSleep, (LPARAM)PowerActionSleep, g_SystemBatteries);
- }
-
- if (bHibernate)
- {
- AddItem(hList1, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate,
g_SystemBatteries);
- }
- }
- else
- {
- ShowWindow(GetDlgItem(hAdv, IDC_VIDEODIMDISPLAY), FALSE);
- ShowWindow(GetDlgItem(hAdv, IDC_SLIDCLOSE), FALSE);
- ShowWindow(hList1, FALSE);
- }
-
- hList2 = GetDlgItem(hAdv, IDC_POWERBUTTON);
- SendMessage(hList2, CB_RESETCONTENT, 0, 0);
-
- memset(g_PowerButton, 0x0, sizeof(g_PowerButton));
- if (spc.PowerButtonPresent)
- {
- AddItem(hList2, IDS_PowerActionNone1, (LPARAM)PowerActionNone, g_PowerButton);
- AddItem(hList2, IDS_PowerActionWarmEject, (LPARAM)PowerActionWarmEject,
g_PowerButton);
-
- if (bSuspend)
- {
- AddItem(hList2, IDS_PowerActionSleep, (LPARAM)PowerActionSleep, g_PowerButton);
- }
-
- if (bHibernate)
- {
- AddItem(hList2, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate,
g_PowerButton);
-
- }
- if (bShutdown)
- {
- AddItem(hList2, IDS_PowerActionShutdown, (LPARAM)PowerActionShutdown, g_PowerButton);
- }
- }
- else
- {
- ShowWindow(GetDlgItem(hAdv, IDC_SPOWERBUTTON), FALSE);
- ShowWindow(hList2, FALSE);
- }
-
- hList3=GetDlgItem(hAdv, IDC_SLEEPBUTTON);
- SendMessage(hList3, CB_RESETCONTENT, 0, 0);
+ HWND hList1;
+ HWND hList2;
+ HWND hList3;
+
+ BOOLEAN bSuspend = FALSE;
+ BOOLEAN bHibernate;
+ BOOLEAN bShutdown;
+
+ SYSTEM_POWER_CAPABILITIES spc;
+
+ CheckDlgButton(hAdv,
+ IDC_SYSTRAYBATTERYMETER,
+ gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter ? BST_CHECKED :
BST_UNCHECKED);
+ CheckDlgButton(hAdv,
+ IDC_PASSWORDLOGON,
+ gGPP.user.GlobalFlags & EnablePasswordLogon ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hAdv,
+ IDC_VIDEODIMDISPLAY,
+ gGPP.user.GlobalFlags & EnableVideoDimDisplay ? BST_CHECKED :
BST_UNCHECKED);
+
+ GetPwrCapabilities(&spc);
+
+ if (spc.SystemS1 || spc.SystemS2 || spc.SystemS3)
+ bSuspend=TRUE;
+
+ bHibernate = spc.HiberFilePresent;
+ bShutdown = spc.SystemS5;
+
+ hList1 = GetDlgItem(hAdv, IDC_LIDCLOSE);
+ SendMessage(hList1, CB_RESETCONTENT, 0, 0);
+
+ memset(g_SystemBatteries, 0x0, sizeof(g_SystemBatteries));
+ if (spc.SystemBatteriesPresent)
+ {
+ AddItem(hList1, IDS_PowerActionNone1, (LPARAM)PowerActionNone,
g_SystemBatteries);
+
+ if (bSuspend)
+ {
+ AddItem(hList1, IDS_PowerActionSleep, (LPARAM)PowerActionSleep,
g_SystemBatteries);
+ }
+
+ if (bHibernate)
+ {
+ AddItem(hList1, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate,
g_SystemBatteries);
+ }
+ }
+ else
+ {
+ ShowWindow(GetDlgItem(hAdv, IDC_VIDEODIMDISPLAY), FALSE);
+ ShowWindow(GetDlgItem(hAdv, IDC_SLIDCLOSE), FALSE);
+ ShowWindow(hList1, FALSE);
+ }
+
+ hList2 = GetDlgItem(hAdv, IDC_POWERBUTTON);
+ SendMessage(hList2, CB_RESETCONTENT, 0, 0);
+
+ memset(g_PowerButton, 0x0, sizeof(g_PowerButton));
+ if (spc.PowerButtonPresent)
+ {
+ AddItem(hList2, IDS_PowerActionNone1, (LPARAM)PowerActionNone, g_PowerButton);
+ AddItem(hList2, IDS_PowerActionWarmEject, (LPARAM)PowerActionWarmEject,
g_PowerButton);
+
+ if (bSuspend)
+ {
+ AddItem(hList2, IDS_PowerActionSleep, (LPARAM)PowerActionSleep,
g_PowerButton);
+ }
+
+ if (bHibernate)
+ {
+ AddItem(hList2, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate,
g_PowerButton);
+
+ }
+ if (bShutdown)
+ {
+ AddItem(hList2, IDS_PowerActionShutdown, (LPARAM)PowerActionShutdown,
g_PowerButton);
+ }
+ }
+ else
+ {
+ ShowWindow(GetDlgItem(hAdv, IDC_SPOWERBUTTON), FALSE);
+ ShowWindow(hList2, FALSE);
+ }
+
+ hList3=GetDlgItem(hAdv, IDC_SLEEPBUTTON);
+ SendMessage(hList3, CB_RESETCONTENT, 0, 0);
memset(g_SleepButton, 0x0, sizeof(g_SleepButton));
- if (spc.SleepButtonPresent)
- {
- AddItem(hList3, IDS_PowerActionNone1, (LPARAM)PowerActionNone, g_SleepButton);
- AddItem(hList3, IDS_PowerActionWarmEject, (LPARAM)PowerActionWarmEject,
g_SleepButton);
-
- if (bSuspend)
- {
- AddItem(hList3, IDS_PowerActionSleep, (LPARAM)PowerActionSleep, g_SleepButton);
- }
-
- if (bHibernate)
- {
- AddItem(hList3, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate,
g_SleepButton);
- }
-
- if (bShutdown)
- {
- AddItem(hList3, IDS_PowerActionShutdown, (LPARAM)PowerActionShutdown, g_SleepButton);
- }
- }
- else
- {
- ShowWindow(GetDlgItem(hAdv, IDC_SSLEEPBUTTON), FALSE);
- ShowWindow(hList3, FALSE);
- }
-
- if (ReadGlobalPwrPolicy(&gGPP))
- {
- ShowCurrentPowerActionPolicies(hAdv);
- }
+ if (spc.SleepButtonPresent)
+ {
+ AddItem(hList3, IDS_PowerActionNone1, (LPARAM)PowerActionNone, g_SleepButton);
+ AddItem(hList3, IDS_PowerActionWarmEject, (LPARAM)PowerActionWarmEject,
g_SleepButton);
+
+ if (bSuspend)
+ {
+ AddItem(hList3, IDS_PowerActionSleep, (LPARAM)PowerActionSleep,
g_SleepButton);
+ }
+
+ if (bHibernate)
+ {
+ AddItem(hList3, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate,
g_SleepButton);
+ }
+
+ if (bShutdown)
+ {
+ AddItem(hList3, IDS_PowerActionShutdown, (LPARAM)PowerActionShutdown,
g_SleepButton);
+ }
+ }
+ else
+ {
+ ShowWindow(GetDlgItem(hAdv, IDC_SSLEEPBUTTON), FALSE);
+ ShowWindow(hList3, FALSE);
+ }
+
+ if (ReadGlobalPwrPolicy(&gGPP))
+ {
+ ShowCurrentPowerActionPolicies(hAdv);
+ }
}
static VOID
Adv_SaveData(HWND hwndDlg)
{
- BOOL bSystrayBatteryMeter;
- BOOL bPasswordLogon;
- BOOL bVideoDimDisplay;
-
- bSystrayBatteryMeter =
- (IsDlgButtonChecked(hwndDlg, IDC_SYSTRAYBATTERYMETER) == BST_CHECKED);
-
- bPasswordLogon =
- (IsDlgButtonChecked(hwndDlg, IDC_PASSWORDLOGON) == BST_CHECKED);
-
- bVideoDimDisplay =
- (IsDlgButtonChecked(hwndDlg, IDC_VIDEODIMDISPLAY) == BST_CHECKED);
-
- if (bSystrayBatteryMeter)
- {
- if (!(gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter))
- {
- gGPP.user.GlobalFlags = gGPP.user.GlobalFlags + EnableSysTrayBatteryMeter;
- }
- }
- else
- {
- if ((gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter))
- {
- gGPP.user.GlobalFlags = gGPP.user.GlobalFlags - EnableSysTrayBatteryMeter;
- }
- }
-
- if (bPasswordLogon)
- {
- if (!(gGPP.user.GlobalFlags & EnablePasswordLogon))
- {
- gGPP.user.GlobalFlags = gGPP.user.GlobalFlags + EnablePasswordLogon;
- }
- }
- else
- {
- if ((gGPP.user.GlobalFlags & EnablePasswordLogon))
- {
- gGPP.user.GlobalFlags = gGPP.user.GlobalFlags - EnablePasswordLogon;
- }
- }
-
- if (bVideoDimDisplay)
- {
- if (!(gGPP.user.GlobalFlags & EnableVideoDimDisplay))
- {
- gGPP.user.GlobalFlags = gGPP.user.GlobalFlags + EnableVideoDimDisplay;
- }
- }
- else
- {
- if ((gGPP.user.GlobalFlags & EnableVideoDimDisplay))
- {
- gGPP.user.GlobalFlags = gGPP.user.GlobalFlags - EnableVideoDimDisplay;
- }
- }
-
- if (!IsBatteryUsed())
- {
- SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
&gGPP.user.PowerButtonAc);
+ BOOL bSystrayBatteryMeter;
+ BOOL bPasswordLogon;
+ BOOL bVideoDimDisplay;
+
+ bSystrayBatteryMeter =
+ (IsDlgButtonChecked(hwndDlg, IDC_SYSTRAYBATTERYMETER) == BST_CHECKED);
+
+ bPasswordLogon =
+ (IsDlgButtonChecked(hwndDlg, IDC_PASSWORDLOGON) == BST_CHECKED);
+
+ bVideoDimDisplay =
+ (IsDlgButtonChecked(hwndDlg, IDC_VIDEODIMDISPLAY) == BST_CHECKED);
+
+ if (bSystrayBatteryMeter)
+ {
+ if (!(gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter))
+ {
+ gGPP.user.GlobalFlags = gGPP.user.GlobalFlags + EnableSysTrayBatteryMeter;
+ }
+ }
+ else
+ {
+ if ((gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter))
+ {
+ gGPP.user.GlobalFlags = gGPP.user.GlobalFlags - EnableSysTrayBatteryMeter;
+ }
+ }
+
+ if (bPasswordLogon)
+ {
+ if (!(gGPP.user.GlobalFlags & EnablePasswordLogon))
+ {
+ gGPP.user.GlobalFlags = gGPP.user.GlobalFlags + EnablePasswordLogon;
+ }
+ }
+ else
+ {
+ if ((gGPP.user.GlobalFlags & EnablePasswordLogon))
+ {
+ gGPP.user.GlobalFlags = gGPP.user.GlobalFlags - EnablePasswordLogon;
+ }
+ }
+
+ if (bVideoDimDisplay)
+ {
+ if (!(gGPP.user.GlobalFlags & EnableVideoDimDisplay))
+ {
+ gGPP.user.GlobalFlags = gGPP.user.GlobalFlags + EnableVideoDimDisplay;
+ }
+ }
+ else
+ {
+ if ((gGPP.user.GlobalFlags & EnableVideoDimDisplay))
+ {
+ gGPP.user.GlobalFlags = gGPP.user.GlobalFlags - EnableVideoDimDisplay;
+ }
+ }
+
+ if (!IsBatteryUsed())
+ {
+ SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
&gGPP.user.PowerButtonAc);
#if 0
- SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE),
&gGPP.user.LidCloseAc);
- SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON),
&gGPP.user.SleepButtonAc);
+ SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE),
&gGPP.user.LidCloseAc);
+ SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON),
&gGPP.user.SleepButtonAc);
#endif
- }
- else
- {
+ }
+ else
+ {
#if 0
- SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
&gGPP.user.PowerButtonDc);
- SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE),
&gGPP.user.LidCloseDc);
- SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON),
&gGPP.user.SleepButtonDc);
+ SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
&gGPP.user.PowerButtonDc);
+ SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE),
&gGPP.user.LidCloseDc);
+ SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON),
&gGPP.user.SleepButtonDc);
#endif
- }
-
- if (!WriteGlobalPwrPolicy(&gGPP))
- {
- MessageBox(hwndDlg, L"WriteGlobalPwrPolicy failed", NULL, MB_OK);
- }
-
- Adv_InitDialog();
+ }
+
+ if (!WriteGlobalPwrPolicy(&gGPP))
+ {
+ MessageBox(hwndDlg, L"WriteGlobalPwrPolicy failed", NULL, MB_OK);
+ }
+
+ Adv_InitDialog();
}
/* Property page dialog callback */
@@ -483,40 +483,40 @@
switch(uMsg)
{
case WM_INITDIALOG:
- hAdv = hwndDlg;
- Adv_InitDialog();
- return TRUE;
+ hAdv = hwndDlg;
+ Adv_InitDialog();
+ return TRUE;
break;
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case IDC_SYSTRAYBATTERYMETER:
- case IDC_PASSWORDLOGON:
- case IDC_VIDEODIMDISPLAY:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
- break;
- case IDC_LIDCLOSE:
- case IDC_POWERBUTTON:
- case IDC_SLEEPBUTTON:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
- break;
- }
- break;
- case WM_NOTIFY:
- {
- LPNMHDR lpnm = (LPNMHDR)lParam;
- if (lpnm->code == (UINT)PSN_APPLY)
- {
- Adv_SaveData(hwndDlg);
- }
- return TRUE;
- }
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDC_SYSTRAYBATTERYMETER:
+ case IDC_PASSWORDLOGON:
+ case IDC_VIDEODIMDISPLAY:
+ if (HIWORD(wParam) == BN_CLICKED)
+ {
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ break;
+ case IDC_LIDCLOSE:
+ case IDC_POWERBUTTON:
+ case IDC_SLEEPBUTTON:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ break;
+ }
+ break;
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnm = (LPNMHDR)lParam;
+ if (lpnm->code == (UINT)PSN_APPLY)
+ {
+ Adv_SaveData(hwndDlg);
+ }
+ return TRUE;
+ }
}
return FALSE;
}
Modified: trunk/reactos/dll/cpl/powercfg/alarms.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/alarms.c?…
==============================================================================
--- trunk/reactos/dll/cpl/powercfg/alarms.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/powercfg/alarms.c [iso-8859-1] Mon Sep 7 21:56:38 2015
@@ -14,152 +14,152 @@
static BOOLEAN
Ala_InitData(HWND hwndDlg)
{
- TCHAR szAction[MAX_PATH];
- TCHAR szText[MAX_PATH];
- TCHAR szSound[MAX_PATH];
- TCHAR szMessage[MAX_PATH];
- TCHAR szTemp[MAX_PATH];
- TCHAR szBatteryLevel[MAX_PATH];
- TCHAR szProgram[MAX_PATH];
+ TCHAR szAction[MAX_PATH];
+ TCHAR szText[MAX_PATH];
+ TCHAR szSound[MAX_PATH];
+ TCHAR szMessage[MAX_PATH];
+ TCHAR szTemp[MAX_PATH];
+ TCHAR szBatteryLevel[MAX_PATH];
+ TCHAR szProgram[MAX_PATH];
- if (!ReadGlobalPwrPolicy(&gGPP))
- {
- return FALSE;
- }
+ if (!ReadGlobalPwrPolicy(&gGPP))
+ {
+ return FALSE;
+ }
- if (gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].Enable)
- {
- CheckDlgButton(hwndDlg, IDC_ALARM1,
- gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].Enable ? BST_CHECKED :
BST_UNCHECKED);
+ if (gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].Enable)
+ {
+ CheckDlgButton(hwndDlg, IDC_ALARM1,
+ gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].Enable ? BST_CHECKED :
BST_UNCHECKED);
- if (LoadString(hApplet, IDS_PROCENT, szTemp, MAX_PATH))
- {
- _stprintf(szBatteryLevel, szTemp,
gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].BatteryLevel);
- SetDlgItemText(hwndDlg, IDC_ALARMVALUE1, szBatteryLevel);
- }
+ if (LoadString(hApplet, IDS_PROCENT, szTemp, MAX_PATH))
+ {
+ _stprintf(szBatteryLevel, szTemp,
gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].BatteryLevel);
+ SetDlgItemText(hwndDlg, IDC_ALARMVALUE1, szBatteryLevel);
+ }
- SendDlgItemMessage(hwndDlg, IDC_ALARMBAR1,
- TBM_SETRANGE,
- (WPARAM)TRUE,
- (LPARAM)MAKELONG(0, 100));
- SendDlgItemMessage(hwndDlg, IDC_ALARMBAR1,
- TBM_SETTICFREQ,
- (WPARAM)TRUE,
- (LPARAM)20);
- SendDlgItemMessage(hwndDlg, IDC_ALARMBAR1,
- TBM_SETPOS,
- (WPARAM)TRUE,
- (LPARAM)gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].BatteryLevel);
+ SendDlgItemMessage(hwndDlg, IDC_ALARMBAR1,
+ TBM_SETRANGE,
+ (WPARAM)TRUE,
+ (LPARAM)MAKELONG(0, 100));
+ SendDlgItemMessage(hwndDlg, IDC_ALARMBAR1,
+ TBM_SETTICFREQ,
+ (WPARAM)TRUE,
+ (LPARAM)20);
+ SendDlgItemMessage(hwndDlg, IDC_ALARMBAR1,
+ TBM_SETPOS,
+ (WPARAM)TRUE,
+ (LPARAM)gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].BatteryLevel);
- if (LoadString(hApplet,
gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.Action+IDS_PowerActionNone1,
szAction, MAX_PATH))
- {
- SetDlgItemText(hwndDlg, IDC_ALARMAKTION1, szAction);
- }
+ if (LoadString(hApplet,
gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.Action+IDS_PowerActionNone1,
szAction, MAX_PATH))
+ {
+ SetDlgItemText(hwndDlg, IDC_ALARMAKTION1, szAction);
+ }
- memset(szMessage, 0x0, sizeof(szMessage));
- LoadString(hApplet, IDS_NOACTION, szMessage, MAX_PATH);
+ memset(szMessage, 0x0, sizeof(szMessage));
+ LoadString(hApplet, IDS_NOACTION, szMessage, MAX_PATH);
- if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.EventCode) &
POWER_LEVEL_USER_NOTIFY_TEXT)
- {
- if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.EventCode)
& POWER_LEVEL_USER_NOTIFY_SOUND)
- {
- if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH) && LoadString(hApplet,
IDS_TEXT, szText, MAX_PATH))
- {
- _stprintf(szMessage,_T("%s, %s"),szSound,szText);
- }
- }
- else
- {
- if (LoadString(hApplet, IDS_TEXT, szText, MAX_PATH))
- {
- _stprintf(szMessage,_T("%s"),szText);
- }
- }
- }
- else
- {
- if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.EventCode)
& POWER_LEVEL_USER_NOTIFY_SOUND)
- {
- if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH))
- {
- _stprintf(szMessage,_T("%s"),szSound);
- }
- }
- }
+ if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.EventCode)
& POWER_LEVEL_USER_NOTIFY_TEXT)
+ {
+ if
(LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.EventCode) &
POWER_LEVEL_USER_NOTIFY_SOUND)
+ {
+ if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH) &&
LoadString(hApplet, IDS_TEXT, szText, MAX_PATH))
+ {
+ _stprintf(szMessage,_T("%s, %s"),szSound,szText);
+ }
+ }
+ else
+ {
+ if (LoadString(hApplet, IDS_TEXT, szText, MAX_PATH))
+ {
+ _stprintf(szMessage,_T("%s"),szText);
+ }
+ }
+ }
+ else
+ {
+ if
(LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.EventCode) &
POWER_LEVEL_USER_NOTIFY_SOUND)
+ {
+ if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH))
+ {
+ _stprintf(szMessage,_T("%s"),szSound);
+ }
+ }
+ }
- SetDlgItemText(hwndDlg, IDC_ALARMMSG1, szMessage);
+ SetDlgItemText(hwndDlg, IDC_ALARMMSG1, szMessage);
- if (LoadString(hApplet, IDS_PowerActionNone2, szProgram, MAX_PATH))
- {
- SetDlgItemText(hwndDlg, IDC_ALARMPROG1, szProgram);
- }
- }
+ if (LoadString(hApplet, IDS_PowerActionNone2, szProgram, MAX_PATH))
+ {
+ SetDlgItemText(hwndDlg, IDC_ALARMPROG1, szProgram);
+ }
+ }
- if (gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].Enable)
- {
- CheckDlgButton(hwndDlg, IDC_ALARM2,
- gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].Enable ? BST_CHECKED :
BST_UNCHECKED);
+ if (gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].Enable)
+ {
+ CheckDlgButton(hwndDlg, IDC_ALARM2,
+ gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].Enable ? BST_CHECKED :
BST_UNCHECKED);
- if (LoadString(hApplet, IDS_PROCENT, szTemp, MAX_PATH))
- {
- _stprintf(szBatteryLevel, szTemp,
gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].BatteryLevel);
- SetDlgItemText(hwndDlg, IDC_ALARMVALUE2, szBatteryLevel);
- }
+ if (LoadString(hApplet, IDS_PROCENT, szTemp, MAX_PATH))
+ {
+ _stprintf(szBatteryLevel, szTemp,
gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].BatteryLevel);
+ SetDlgItemText(hwndDlg, IDC_ALARMVALUE2, szBatteryLevel);
+ }
- SendDlgItemMessage(hwndDlg, IDC_ALARMBAR2,
- TBM_SETRANGE,
- (WPARAM)TRUE,
- (LPARAM)MAKELONG(0, 100));
- SendDlgItemMessage(hwndDlg, IDC_ALARMBAR2,
- TBM_SETPOS,
- (WPARAM)TRUE,
- (LPARAM)gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].BatteryLevel);
+ SendDlgItemMessage(hwndDlg, IDC_ALARMBAR2,
+ TBM_SETRANGE,
+ (WPARAM)TRUE,
+ (LPARAM)MAKELONG(0, 100));
+ SendDlgItemMessage(hwndDlg, IDC_ALARMBAR2,
+ TBM_SETPOS,
+ (WPARAM)TRUE,
+ (LPARAM)gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].BatteryLevel);
- if (LoadString(hApplet,
gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.Action+IDS_PowerActionNone1,
szAction, MAX_PATH))
- {
- SetDlgItemText(hwndDlg, IDC_ALARMAKTION2, szAction);
- }
+ if (LoadString(hApplet,
gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.Action+IDS_PowerActionNone1,
szAction, MAX_PATH))
+ {
+ SetDlgItemText(hwndDlg, IDC_ALARMAKTION2, szAction);
+ }
- memset(szMessage, 0x0, sizeof(szMessage));
- LoadString(hApplet, IDS_NOACTION, szMessage, MAX_PATH);
+ memset(szMessage, 0x0, sizeof(szMessage));
+ LoadString(hApplet, IDS_NOACTION, szMessage, MAX_PATH);
- if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.EventCode)
& POWER_LEVEL_USER_NOTIFY_TEXT)
- {
- if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.EventCode)
& POWER_LEVEL_USER_NOTIFY_SOUND)
- {
- if (LoadString(hApplet, IDS_TEXT, szText, MAX_PATH) && LoadString(hApplet,
IDS_SOUND, szSound, MAX_PATH))
- {
- _stprintf(szMessage,_T("%s, %s"),szSound,szText);
- }
- }
- else
- {
- if (LoadString(hApplet, IDS_TEXT, szText, MAX_PATH))
- {
- _stprintf(szMessage,_T("%s"),szText);
- }
- }
- }
- else
- {
- if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.EventCode)
& POWER_LEVEL_USER_NOTIFY_SOUND)
- {
- if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH))
- {
- _stprintf(szMessage,_T("%s"),szSound);
- }
- }
- }
+ if
(LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.EventCode) &
POWER_LEVEL_USER_NOTIFY_TEXT)
+ {
+ if
(LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.EventCode) &
POWER_LEVEL_USER_NOTIFY_SOUND)
+ {
+ if (LoadString(hApplet, IDS_TEXT, szText, MAX_PATH) &&
LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH))
+ {
+ _stprintf(szMessage,_T("%s, %s"),szSound,szText);
+ }
+ }
+ else
+ {
+ if (LoadString(hApplet, IDS_TEXT, szText, MAX_PATH))
+ {
+ _stprintf(szMessage,_T("%s"),szText);
+ }
+ }
+ }
+ else
+ {
+ if
(LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.EventCode) &
POWER_LEVEL_USER_NOTIFY_SOUND)
+ {
+ if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH))
+ {
+ _stprintf(szMessage,_T("%s"),szSound);
+ }
+ }
+ }
- SetDlgItemText(hwndDlg, IDC_ALARMMSG2, szMessage);
+ SetDlgItemText(hwndDlg, IDC_ALARMMSG2, szMessage);
- if (LoadString(hApplet, IDS_PowerActionNone2, szProgram, MAX_PATH))
- {
- SetDlgItemText(hwndDlg, IDC_ALARMPROG2, szProgram);
- }
- }
+ if (LoadString(hApplet, IDS_PowerActionNone2, szProgram, MAX_PATH))
+ {
+ SetDlgItemText(hwndDlg, IDC_ALARMPROG2, szProgram);
+ }
+ }
- return TRUE;
+ return TRUE;
}
/* Property page dialog callback */
@@ -174,14 +174,14 @@
switch(uMsg)
{
case WM_INITDIALOG:
- if (!Ala_InitData(hwndDlg))
- {
- // TODO:
- // Handle initialization error
- }
- return TRUE;
- default:
- break;
+ if (!Ala_InitData(hwndDlg))
+ {
+ // TODO:
+ // Handle initialization error
+ }
+ return TRUE;
+ default:
+ break;
}
return FALSE;
}
Modified: trunk/reactos/dll/cpl/powercfg/hibernate.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/hibernate…
==============================================================================
--- trunk/reactos/dll/cpl/powercfg/hibernate.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/powercfg/hibernate.c [iso-8859-1] Mon Sep 7 21:56:38 2015
@@ -18,98 +18,98 @@
static VOID
Hib_InitDialog(HWND hwndDlg)
{
- SYSTEM_POWER_CAPABILITIES PowerCaps;
- MEMORYSTATUSEX msex;
- TCHAR szSize[MAX_PATH];
- TCHAR szTemp[MAX_PATH];
- ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
+ SYSTEM_POWER_CAPABILITIES PowerCaps;
+ MEMORYSTATUSEX msex;
+ TCHAR szSize[MAX_PATH];
+ TCHAR szTemp[MAX_PATH];
+ ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
- if (GetPwrCapabilities(&PowerCaps))
- {
- CheckDlgButton(hwndDlg,
- IDC_HIBERNATEFILE,
- PowerCaps.HiberFilePresent ? BST_CHECKED : BST_UNCHECKED);
+ if (GetPwrCapabilities(&PowerCaps))
+ {
+ CheckDlgButton(hwndDlg,
+ IDC_HIBERNATEFILE,
+ PowerCaps.HiberFilePresent ? BST_CHECKED : BST_UNCHECKED);
- msex.dwLength = sizeof(msex);
- if (!GlobalMemoryStatusEx(&msex))
- {
- return; // FIXME
- }
+ msex.dwLength = sizeof(msex);
+ if (!GlobalMemoryStatusEx(&msex))
+ {
+ return; // FIXME
+ }
- if (GetWindowsDirectory(szTemp,MAX_PATH))
- {
- if (!GetDiskFreeSpaceEx(szTemp,&FreeBytesAvailable, &TotalNumberOfBytes,
&TotalNumberOfFreeBytes))
- TotalNumberOfFreeBytes.QuadPart = 0;
- }
- else
- {
- if (!GetDiskFreeSpaceEx(NULL,&FreeBytesAvailable, &TotalNumberOfBytes,
&TotalNumberOfFreeBytes))
- TotalNumberOfFreeBytes.QuadPart = 0;
- }
+ if (GetWindowsDirectory(szTemp,MAX_PATH))
+ {
+ if (!GetDiskFreeSpaceEx(szTemp,&FreeBytesAvailable,
&TotalNumberOfBytes, &TotalNumberOfFreeBytes))
+ TotalNumberOfFreeBytes.QuadPart = 0;
+ }
+ else
+ {
+ if (!GetDiskFreeSpaceEx(NULL,&FreeBytesAvailable,
&TotalNumberOfBytes, &TotalNumberOfFreeBytes))
+ TotalNumberOfFreeBytes.QuadPart = 0;
+ }
- if (TotalNumberOfFreeBytes.QuadPart > 0x100000)
- {
- if (LoadString(hApplet, IDS_SIZEMB, szTemp, MAX_PATH))
- {
- _stprintf(szSize,szTemp,TotalNumberOfFreeBytes.QuadPart / 0x100000);
- SetDlgItemText(hwndDlg, IDC_FREESPACE, szSize);
- }
- }
- else
- {
- if (LoadString(hApplet, IDS_SIZEBYTS, szTemp, MAX_PATH))
- {
- _stprintf(szSize,szTemp,TotalNumberOfFreeBytes.QuadPart);
- SetDlgItemText(hwndDlg, IDC_FREESPACE, szSize);
- }
- }
+ if (TotalNumberOfFreeBytes.QuadPart > 0x100000)
+ {
+ if (LoadString(hApplet, IDS_SIZEMB, szTemp, MAX_PATH))
+ {
+ _stprintf(szSize,szTemp,TotalNumberOfFreeBytes.QuadPart / 0x100000);
+ SetDlgItemText(hwndDlg, IDC_FREESPACE, szSize);
+ }
+ }
+ else
+ {
+ if (LoadString(hApplet, IDS_SIZEBYTS, szTemp, MAX_PATH))
+ {
+ _stprintf(szSize,szTemp,TotalNumberOfFreeBytes.QuadPart);
+ SetDlgItemText(hwndDlg, IDC_FREESPACE, szSize);
+ }
+ }
- if (msex.ullTotalPhys>0x100000)
- {
- if (LoadString(hApplet, IDS_SIZEMB, szTemp, MAX_PATH))
- {
- _stprintf(szSize,szTemp,msex.ullTotalPhys/0x100000);
- SetDlgItemText(hwndDlg, IDC_SPACEFORHIBERNATEFILE,szSize);
- }
- }
- else
- {
- if (LoadString(hApplet, IDS_SIZEBYTS, szTemp, MAX_PATH))
- {
- _stprintf(szSize,szTemp,msex.ullTotalPhys);
- SetDlgItemText(hwndDlg, IDC_SPACEFORHIBERNATEFILE, szSize);
- }
- }
+ if (msex.ullTotalPhys>0x100000)
+ {
+ if (LoadString(hApplet, IDS_SIZEMB, szTemp, MAX_PATH))
+ {
+ _stprintf(szSize,szTemp,msex.ullTotalPhys/0x100000);
+ SetDlgItemText(hwndDlg, IDC_SPACEFORHIBERNATEFILE,szSize);
+ }
+ }
+ else
+ {
+ if (LoadString(hApplet, IDS_SIZEBYTS, szTemp, MAX_PATH))
+ {
+ _stprintf(szSize,szTemp,msex.ullTotalPhys);
+ SetDlgItemText(hwndDlg, IDC_SPACEFORHIBERNATEFILE, szSize);
+ }
+ }
- if (TotalNumberOfFreeBytes.QuadPart < msex.ullTotalPhys &&
!PowerCaps.HiberFilePresent)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), FALSE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_TOLESSFREESPACE), TRUE);
- }
- else
- {
- ShowWindow(GetDlgItem(hwndDlg, IDC_TOLESSFREESPACE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), TRUE);
- }
- }
+ if (TotalNumberOfFreeBytes.QuadPart < msex.ullTotalPhys &&
!PowerCaps.HiberFilePresent)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), FALSE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_TOLESSFREESPACE), TRUE);
+ }
+ else
+ {
+ ShowWindow(GetDlgItem(hwndDlg, IDC_TOLESSFREESPACE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), TRUE);
+ }
+ }
}
INT_PTR
Hib_SaveData(HWND hwndDlg)
{
- BOOLEAN bHibernate;
+ BOOLEAN bHibernate;
- bHibernate = (BOOLEAN)(IsDlgButtonChecked(hwndDlg, IDC_HIBERNATEFILE) == BST_CHECKED);
+ bHibernate = (BOOLEAN)(IsDlgButtonChecked(hwndDlg, IDC_HIBERNATEFILE) ==
BST_CHECKED);
- if (CallNtPowerInformation(SystemReserveHiberFile,&bHibernate, sizeof(bHibernate),
NULL, 0) == STATUS_SUCCESS)
- {
- Pos_InitData();
- Adv_InitDialog();
- Hib_InitDialog(hwndDlg);
- return TRUE;
- }
+ if (CallNtPowerInformation(SystemReserveHiberFile,&bHibernate,
sizeof(bHibernate), NULL, 0) == STATUS_SUCCESS)
+ {
+ Pos_InitData();
+ Adv_InitDialog();
+ Hib_InitDialog(hwndDlg);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
/* Property page dialog callback */
@@ -122,26 +122,26 @@
switch(uMsg)
{
case WM_INITDIALOG:
- Hib_InitDialog(hwndDlg);
- return TRUE;
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case IDC_HIBERNATEFILE:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
- }
- break;
- case WM_NOTIFY:
- {
- LPNMHDR lpnm = (LPNMHDR)lParam;
- if (lpnm->code == (UINT)PSN_APPLY)
- {
- return Hib_SaveData(hwndDlg);
- }
- }
+ Hib_InitDialog(hwndDlg);
+ return TRUE;
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDC_HIBERNATEFILE:
+ if (HIWORD(wParam) == BN_CLICKED)
+ {
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ }
+ break;
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnm = (LPNMHDR)lParam;
+ if (lpnm->code == (UINT)PSN_APPLY)
+ {
+ return Hib_SaveData(hwndDlg);
+ }
+ }
}
return FALSE;
}
Modified: trunk/reactos/dll/cpl/powercfg/powercfg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/powercfg.…
==============================================================================
--- trunk/reactos/dll/cpl/powercfg/powercfg.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/powercfg/powercfg.c [iso-8859-1] Mon Sep 7 21:56:38 2015
@@ -14,7 +14,7 @@
#include <winreg.h>
#include <regstr.h>
-#define NUM_APPLETS (1)
+#define NUM_APPLETS (1)
static LONG APIENTRY Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);
@@ -101,9 +101,9 @@
if (GetPwrCapabilities(&spc))
{
if (spc.SystemBatteriesPresent)
- {
- InitPropSheetPage(&psh, IDD_PROPPAGEALARMS, (DLGPROC)AlarmsDlgProc);
- }
+ {
+ InitPropSheetPage(&psh, IDD_PROPPAGEALARMS, (DLGPROC)AlarmsDlgProc);
+ }
}
InitPropSheetPage(&psh, IDD_PROPPAGEADVANCED, (DLGPROC)AdvancedDlgProc);
InitPropSheetPage(&psh, IDD_PROPPAGEHIBERNATE, (DLGPROC)HibernateDlgProc);
Modified: trunk/reactos/dll/cpl/powercfg/powershemes.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/powershem…
==============================================================================
--- trunk/reactos/dll/cpl/powercfg/powershemes.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/powercfg/powershemes.c [iso-8859-1] Mon Sep 7 21:56:38 2015
@@ -13,22 +13,22 @@
UINT Sec[]=
{
- 60,
- 120,
- 180,
- 300,
- 600,
- 900,
- 1200,
- 1500,
- 1800,
- 2700,
- 3600,
- 7200,
- 10800,
- 14400,
- 18000,
- 0
+ 60,
+ 120,
+ 180,
+ 300,
+ 600,
+ 900,
+ 1200,
+ 1500,
+ 1800,
+ 2700,
+ 3600,
+ 7200,
+ 10800,
+ 14400,
+ 18000,
+ 0
};
HWND hList = 0;
@@ -36,7 +36,7 @@
unsigned aps = 0;
-#define MAX_POWER_POLICY 20
+#define MAX_POWER_POLICY 20
POWER_POLICY gPP[MAX_POWER_POLICY];
UINT guiIndex = 0;
@@ -46,193 +46,193 @@
BOOLEAN
Pos_InitData(VOID)
{
- SYSTEM_POWER_CAPABILITIES spc;
+ SYSTEM_POWER_CAPABILITIES spc;
/*
- RECT rectCtl, rectDlg, rectCtl2;
- LONG movetop = 0;
- LONG moveright = 0;
-
- if (GetWindowRect(hPos,&rectDlg))
- {
- if (GetWindowRect(GetDlgItem(hPos, IDC_SAT),&rectCtl2))
- {
- if (GetWindowRect(GetDlgItem(hPos, IDC_MONITOR),&rectCtl))
- {
- movetop=rectCtl.top - rectCtl2.top;
- MoveWindow(GetDlgItem(hPos,
IDC_MONITOR),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
- if (GetWindowRect(GetDlgItem(hPos, IDC_DISK),&rectCtl))
- {
- MoveWindow(GetDlgItem(hPos,
IDC_DISK),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
- }
- if (GetWindowRect(GetDlgItem(hPos, IDC_STANDBY),&rectCtl))
- {
- MoveWindow(GetDlgItem(hPos,
IDC_STANDBY),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
- }
- if (GetWindowRect(GetDlgItem(hPos, IDC_HYBERNATE),&rectCtl))
- {
- MoveWindow(GetDlgItem(hPos,
IDC_HYBERNATE),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
- }
- if (GetWindowRect(GetDlgItem(hPos, IDC_MONITORDCLIST),&rectCtl2))
- {
- movetop=movetop-8;
- if (GetWindowRect(GetDlgItem(hPos, IDC_MONITORACLIST),&rectCtl))
- {
- moveright=rectCtl.right - rectCtl2.right;
- MoveWindow(GetDlgItem(hPos,
IDC_MONITORACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE);
- if (GetWindowRect(GetDlgItem(hPos, IDC_DISKACLIST),&rectCtl))
- {
- MoveWindow(GetDlgItem(hPos,
IDC_DISKACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE);
- }
- if (GetWindowRect(GetDlgItem(hPos, IDC_STANDBYACLIST),&rectCtl))
- {
- MoveWindow(GetDlgItem(hPos,
IDC_STANDBYACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE);
- }
- if (GetWindowRect(GetDlgItem(hPos, IDC_HYBERNATEACLIST),&rectCtl))
- {
- MoveWindow(GetDlgItem(hPos,
IDC_HYBERNATEACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE);
- }
- }
- if (GetWindowRect(GetDlgItem(hPos, IDC_GRPDETAIL),&rectCtl))
- {
- MoveWindow(GetDlgItem(hPos,
IDC_GRPDETAIL),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
- }
- }
- }
- }
- }
- }
+ RECT rectCtl, rectDlg, rectCtl2;
+ LONG movetop = 0;
+ LONG moveright = 0;
+
+ if (GetWindowRect(hPos,&rectDlg))
+ {
+ if (GetWindowRect(GetDlgItem(hPos, IDC_SAT),&rectCtl2))
+ {
+ if (GetWindowRect(GetDlgItem(hPos, IDC_MONITOR),&rectCtl))
+ {
+ movetop=rectCtl.top - rectCtl2.top;
+ MoveWindow(GetDlgItem(hPos,
IDC_MONITOR),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
+ if (GetWindowRect(GetDlgItem(hPos, IDC_DISK),&rectCtl))
+ {
+ MoveWindow(GetDlgItem(hPos,
IDC_DISK),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
+ }
+ if (GetWindowRect(GetDlgItem(hPos, IDC_STANDBY),&rectCtl))
+ {
+ MoveWindow(GetDlgItem(hPos,
IDC_STANDBY),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
+ }
+ if (GetWindowRect(GetDlgItem(hPos, IDC_HYBERNATE),&rectCtl))
+ {
+ MoveWindow(GetDlgItem(hPos,
IDC_HYBERNATE),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
+ }
+ if (GetWindowRect(GetDlgItem(hPos,
IDC_MONITORDCLIST),&rectCtl2))
+ {
+ movetop=movetop-8;
+ if (GetWindowRect(GetDlgItem(hPos,
IDC_MONITORACLIST),&rectCtl))
+ {
+ moveright=rectCtl.right - rectCtl2.right;
+ MoveWindow(GetDlgItem(hPos,
IDC_MONITORACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE);
+ if (GetWindowRect(GetDlgItem(hPos,
IDC_DISKACLIST),&rectCtl))
+ {
+ MoveWindow(GetDlgItem(hPos,
IDC_DISKACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE);
+ }
+ if (GetWindowRect(GetDlgItem(hPos,
IDC_STANDBYACLIST),&rectCtl))
+ {
+ MoveWindow(GetDlgItem(hPos,
IDC_STANDBYACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE);
+ }
+ if (GetWindowRect(GetDlgItem(hPos,
IDC_HYBERNATEACLIST),&rectCtl))
+ {
+ MoveWindow(GetDlgItem(hPos,
IDC_HYBERNATEACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE);
+ }
+ }
+ if (GetWindowRect(GetDlgItem(hPos, IDC_GRPDETAIL),&rectCtl))
+ {
+ MoveWindow(GetDlgItem(hPos,
IDC_GRPDETAIL),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE);
+ }
+ }
+ }
+ }
+ }
+ }
*/
- if (!GetPwrCapabilities(&spc))
- {
- return FALSE;
- }
-
- if (!spc.SystemBatteriesPresent)
- {
- ShowWindow(GetDlgItem(hPos, IDC_SAT),FALSE);
- ShowWindow(GetDlgItem(hPos, IDC_IAC),FALSE);
- ShowWindow(GetDlgItem(hPos, IDC_SAC),FALSE);
- ShowWindow(GetDlgItem(hPos, IDC_IDC),FALSE);
- ShowWindow(GetDlgItem(hPos, IDC_SDC),FALSE);
- ShowWindow(GetDlgItem(hPos, IDC_MONITORDCLIST),FALSE);
- ShowWindow(GetDlgItem(hPos, IDC_DISKDCLIST),FALSE);
- ShowWindow(GetDlgItem(hPos, IDC_STANDBYDCLIST),FALSE);
- ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEDCLIST),FALSE);
- ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEACLIST), spc.HiberFilePresent);
-
- }
- else
- {
- ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEDCLIST), spc.HiberFilePresent);
- ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEACLIST), FALSE);
- }
-
-
- if (!(spc.SystemS1 ||spc.SystemS2 || spc.SystemS3))
- {
- ShowWindow(GetDlgItem(hPos, IDC_STANDBYACLIST), TRUE);
- ShowWindow(GetDlgItem(hPos, IDC_STANDBYDCLIST), TRUE);
- ShowWindow(GetDlgItem(hPos, IDC_STANDBY), TRUE);
- }
-
- ShowWindow(GetDlgItem(hPos, IDC_HYBERNATE), spc.HiberFilePresent);
-
- return TRUE;
+ if (!GetPwrCapabilities(&spc))
+ {
+ return FALSE;
+ }
+
+ if (!spc.SystemBatteriesPresent)
+ {
+ ShowWindow(GetDlgItem(hPos, IDC_SAT),FALSE);
+ ShowWindow(GetDlgItem(hPos, IDC_IAC),FALSE);
+ ShowWindow(GetDlgItem(hPos, IDC_SAC),FALSE);
+ ShowWindow(GetDlgItem(hPos, IDC_IDC),FALSE);
+ ShowWindow(GetDlgItem(hPos, IDC_SDC),FALSE);
+ ShowWindow(GetDlgItem(hPos, IDC_MONITORDCLIST),FALSE);
+ ShowWindow(GetDlgItem(hPos, IDC_DISKDCLIST),FALSE);
+ ShowWindow(GetDlgItem(hPos, IDC_STANDBYDCLIST),FALSE);
+ ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEDCLIST),FALSE);
+ ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEACLIST), spc.HiberFilePresent);
+
+ }
+ else
+ {
+ ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEDCLIST), spc.HiberFilePresent);
+ ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEACLIST), FALSE);
+ }
+
+
+ if (!(spc.SystemS1 ||spc.SystemS2 || spc.SystemS3))
+ {
+ ShowWindow(GetDlgItem(hPos, IDC_STANDBYACLIST), TRUE);
+ ShowWindow(GetDlgItem(hPos, IDC_STANDBYDCLIST), TRUE);
+ ShowWindow(GetDlgItem(hPos, IDC_STANDBY), TRUE);
+ }
+
+ ShowWindow(GetDlgItem(hPos, IDC_HYBERNATE), spc.HiberFilePresent);
+
+ return TRUE;
}
static VOID
LoadConfig(HWND hwndDlg)
{
- INT i=0, iCurSel=0;
- UINT uiIndex;
- TCHAR szProfile[MAX_PATH];
- TCHAR szTemp[MAX_PATH];
- TCHAR szConfig[MAX_PATH];
- POWER_POLICY pp;
-
- iCurSel = (INT)SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST,
- CB_GETCURSEL,
- 0,
- 0);
- if (iCurSel == CB_ERR)
- return;
-
- memcpy(&pp, &gPP[iCurSel], sizeof(POWER_POLICY));
-
- uiIndex = (UINT)SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, CB_GETCURSEL, 0, 0);
- if(uiIndex != (UINT)CB_ERR)
- {
- SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, CB_GETLBTEXT, uiIndex, (LPARAM)szProfile);
- if(LoadString(hApplet, IDS_CONFIG1, szTemp, MAX_PATH))
- {
- _stprintf(szConfig,szTemp,szProfile);
- SetWindowText(GetDlgItem(hwndDlg, IDC_GRPDETAIL),szConfig);
- }
- }
-
- for(i=0;i<16;i++)
- {
- if (Sec[i]==pp.user.VideoTimeoutAc)
- {
- SendDlgItemMessage(hwndDlg, IDC_MONITORACLIST,
- CB_SETCURSEL,
- i,
- (LPARAM)0);
- }
-
- if (Sec[i]==pp.user.VideoTimeoutDc)
- {
- SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST,
- CB_SETCURSEL,
- i,
- (LPARAM)0);
- }
- if (Sec[i]==pp.user.SpindownTimeoutAc)
- {
- SendDlgItemMessage(hwndDlg, IDC_DISKACLIST,
- CB_SETCURSEL,
- i-2,
- (LPARAM)0);
- }
- if (Sec[i]==pp.user.SpindownTimeoutDc) // IdleTimeoutDc)
- {
- SendDlgItemMessage(hwndDlg, IDC_DISKDCLIST,
- CB_SETCURSEL,
- i-2,
- (LPARAM)0);
- }
- if (Sec[i]==pp.user.IdleTimeoutAc)
- {
- SendDlgItemMessage(hwndDlg, IDC_STANDBYACLIST,
- CB_SETCURSEL,
- i,
- (LPARAM)0);
- }
- if (Sec[i]==pp.user.IdleTimeoutDc)
- {
- SendDlgItemMessage(hwndDlg, IDC_STANDBYDCLIST,
- CB_SETCURSEL,
- i,
- (LPARAM)0);
- }
-
- if (Sec[i]==pp.mach.DozeS4TimeoutAc)
- {
- SendDlgItemMessage(hwndDlg, IDC_HYBERNATEACLIST,
- CB_SETCURSEL,
- i,
- (LPARAM)0);
- }
- if (Sec[i]==pp.mach.DozeS4TimeoutDc)
- {
- SendDlgItemMessage(hwndDlg, IDC_HYBERNATEDCLIST,
- CB_SETCURSEL,
- i,
- (LPARAM)0);
- }
- }
+ INT i=0, iCurSel=0;
+ UINT uiIndex;
+ TCHAR szProfile[MAX_PATH];
+ TCHAR szTemp[MAX_PATH];
+ TCHAR szConfig[MAX_PATH];
+ POWER_POLICY pp;
+
+ iCurSel = (INT)SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST,
+ CB_GETCURSEL,
+ 0,
+ 0);
+ if (iCurSel == CB_ERR)
+ return;
+
+ memcpy(&pp, &gPP[iCurSel], sizeof(POWER_POLICY));
+
+ uiIndex = (UINT)SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, CB_GETCURSEL, 0, 0);
+ if(uiIndex != (UINT)CB_ERR)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, CB_GETLBTEXT, uiIndex,
(LPARAM)szProfile);
+ if(LoadString(hApplet, IDS_CONFIG1, szTemp, MAX_PATH))
+ {
+ _stprintf(szConfig,szTemp,szProfile);
+ SetWindowText(GetDlgItem(hwndDlg, IDC_GRPDETAIL),szConfig);
+ }
+ }
+
+ for(i=0;i<16;i++)
+ {
+ if (Sec[i]==pp.user.VideoTimeoutAc)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_MONITORACLIST,
+ CB_SETCURSEL,
+ i,
+ (LPARAM)0);
+ }
+
+ if (Sec[i]==pp.user.VideoTimeoutDc)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST,
+ CB_SETCURSEL,
+ i,
+ (LPARAM)0);
+ }
+ if (Sec[i]==pp.user.SpindownTimeoutAc)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_DISKACLIST,
+ CB_SETCURSEL,
+ i-2,
+ (LPARAM)0);
+ }
+ if (Sec[i]==pp.user.SpindownTimeoutDc) // IdleTimeoutDc)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_DISKDCLIST,
+ CB_SETCURSEL,
+ i-2,
+ (LPARAM)0);
+ }
+ if (Sec[i]==pp.user.IdleTimeoutAc)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_STANDBYACLIST,
+ CB_SETCURSEL,
+ i,
+ (LPARAM)0);
+ }
+ if (Sec[i]==pp.user.IdleTimeoutDc)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_STANDBYDCLIST,
+ CB_SETCURSEL,
+ i,
+ (LPARAM)0);
+ }
+
+ if (Sec[i]==pp.mach.DozeS4TimeoutAc)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_HYBERNATEACLIST,
+ CB_SETCURSEL,
+ i,
+ (LPARAM)0);
+ }
+ if (Sec[i]==pp.mach.DozeS4TimeoutDc)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_HYBERNATEDCLIST,
+ CB_SETCURSEL,
+ i,
+ (LPARAM)0);
+ }
+ }
}
@@ -240,304 +240,304 @@
callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPTSTR sName, DWORD dwDesc,
LPWSTR sDesc, PPOWER_POLICY pp,LPARAM lParam)
{
- int index;
-
- UNREFERENCED_PARAMETER(lParam);
- UNREFERENCED_PARAMETER(sDesc);
- UNREFERENCED_PARAMETER(dwDesc);
- UNREFERENCED_PARAMETER(dwName);
-
- if (ValidatePowerPolicies(0,pp))
- {
- if (guiIndex >= MAX_POWER_POLICY)
- {
- // FIXME:
- // Implement store power policy dynamically
- return FALSE;
- }
-
-
- memcpy(&gPP[guiIndex], pp, sizeof(POWER_POLICY));
- guiIndex++;
-
- index = (int) SendMessage(hList,
- CB_ADDSTRING,
- 0,
- (LPARAM)sName);
- if (index == CB_ERR)
- return FALSE;
-
- SendMessage(hList,
- CB_SETITEMDATA,
- index,
- (LPARAM)uiIndex);
-
- if (aps == uiIndex)
- {
- SendMessage(hList,
- CB_SELECTSTRING,
- TRUE,
- (LPARAM)sName);
- LoadConfig(GetParent(hList));
- }
- }
- return TRUE;
+ int index;
+
+ UNREFERENCED_PARAMETER(lParam);
+ UNREFERENCED_PARAMETER(sDesc);
+ UNREFERENCED_PARAMETER(dwDesc);
+ UNREFERENCED_PARAMETER(dwName);
+
+ if (ValidatePowerPolicies(0,pp))
+ {
+ if (guiIndex >= MAX_POWER_POLICY)
+ {
+ // FIXME:
+ // Implement store power policy dynamically
+ return FALSE;
+ }
+
+
+ memcpy(&gPP[guiIndex], pp, sizeof(POWER_POLICY));
+ guiIndex++;
+
+ index = (int) SendMessage(hList,
+ CB_ADDSTRING,
+ 0,
+ (LPARAM)sName);
+ if (index == CB_ERR)
+ return FALSE;
+
+ SendMessage(hList,
+ CB_SETITEMDATA,
+ index,
+ (LPARAM)uiIndex);
+
+ if (aps == uiIndex)
+ {
+ SendMessage(hList,
+ CB_SELECTSTRING,
+ TRUE,
+ (LPARAM)sName);
+ LoadConfig(GetParent(hList));
+ }
+ }
+ return TRUE;
}
static VOID
Pos_InitPage(HWND hwndDlg)
{
- int ifrom=0,i=0,imin=0;
- HWND hwnd = NULL;
- TCHAR szName[MAX_PATH];
- LRESULT index;
-
- for(i=1;i<9;i++)
- {
- switch(i)
- {
- case 1:
- hwnd=GetDlgItem(hwndDlg, IDC_MONITORACLIST);
- imin=IDS_TIMEOUT1;
- break;
- case 2:
- hwnd=GetDlgItem(hwndDlg, IDC_STANDBYACLIST);
- imin=IDS_TIMEOUT1;
- break;
- case 3:
- hwnd=GetDlgItem(hwndDlg, IDC_DISKACLIST);
- imin=IDS_TIMEOUT3;
- break;
- case 4:
- hwnd=GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST);
- imin=IDS_TIMEOUT3;
- break;
- case 5:
- hwnd=GetDlgItem(hwndDlg, IDC_MONITORDCLIST);
- imin=IDS_TIMEOUT1;
- break;
- case 6:
- hwnd=GetDlgItem(hwndDlg, IDC_STANDBYDCLIST);
- imin=IDS_TIMEOUT1;
- break;
- case 7:
- hwnd=GetDlgItem(hwndDlg, IDC_DISKDCLIST);
- imin=IDS_TIMEOUT3;
- break;
- case 8:
- hwnd=GetDlgItem(hwndDlg, IDC_HYBERNATEDCLIST);
- imin=IDS_TIMEOUT3;
- break;
- default:
- return;
- }
- for (ifrom=imin;ifrom<(IDS_TIMEOUT15+1);ifrom++)
- {
- if (LoadString(hApplet, ifrom, szName, MAX_PATH))
- {
- index = SendMessage(hwnd,
- CB_ADDSTRING,
- 0,
- (LPARAM)szName);
-
- if (index == CB_ERR)
- return;
-
- SendMessage(hwnd,
- CB_SETITEMDATA,
- index,
- (LPARAM)Sec[ifrom-IDS_TIMEOUT16]);
- }
- }
- if (LoadString(hApplet, IDS_TIMEOUT16, szName, MAX_PATH))
- {
- index = SendMessage(hwnd,
- CB_ADDSTRING,
- 0,
- (LPARAM)szName);
- if (index == CB_ERR)
- return;
-
- SendMessage(hwnd,
- CB_SETITEMDATA,
- index,
- (LPARAM)Sec[0]);
- }
- }
+ int ifrom=0,i=0,imin=0;
+ HWND hwnd = NULL;
+ TCHAR szName[MAX_PATH];
+ LRESULT index;
+
+ for(i=1;i<9;i++)
+ {
+ switch(i)
+ {
+ case 1:
+ hwnd=GetDlgItem(hwndDlg, IDC_MONITORACLIST);
+ imin=IDS_TIMEOUT1;
+ break;
+ case 2:
+ hwnd=GetDlgItem(hwndDlg, IDC_STANDBYACLIST);
+ imin=IDS_TIMEOUT1;
+ break;
+ case 3:
+ hwnd=GetDlgItem(hwndDlg, IDC_DISKACLIST);
+ imin=IDS_TIMEOUT3;
+ break;
+ case 4:
+ hwnd=GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST);
+ imin=IDS_TIMEOUT3;
+ break;
+ case 5:
+ hwnd=GetDlgItem(hwndDlg, IDC_MONITORDCLIST);
+ imin=IDS_TIMEOUT1;
+ break;
+ case 6:
+ hwnd=GetDlgItem(hwndDlg, IDC_STANDBYDCLIST);
+ imin=IDS_TIMEOUT1;
+ break;
+ case 7:
+ hwnd=GetDlgItem(hwndDlg, IDC_DISKDCLIST);
+ imin=IDS_TIMEOUT3;
+ break;
+ case 8:
+ hwnd=GetDlgItem(hwndDlg, IDC_HYBERNATEDCLIST);
+ imin=IDS_TIMEOUT3;
+ break;
+ default:
+ return;
+ }
+ for (ifrom=imin;ifrom<(IDS_TIMEOUT15+1);ifrom++)
+ {
+ if (LoadString(hApplet, ifrom, szName, MAX_PATH))
+ {
+ index = SendMessage(hwnd,
+ CB_ADDSTRING,
+ 0,
+ (LPARAM)szName);
+
+ if (index == CB_ERR)
+ return;
+
+ SendMessage(hwnd,
+ CB_SETITEMDATA,
+ index,
+ (LPARAM)Sec[ifrom-IDS_TIMEOUT16]);
+ }
+ }
+ if (LoadString(hApplet, IDS_TIMEOUT16, szName, MAX_PATH))
+ {
+ index = SendMessage(hwnd,
+ CB_ADDSTRING,
+ 0,
+ (LPARAM)szName);
+ if (index == CB_ERR)
+ return;
+
+ SendMessage(hwnd,
+ CB_SETITEMDATA,
+ index,
+ (LPARAM)Sec[0]);
+ }
+ }
}
static VOID
Pos_SaveData(HWND hwndDlg)
{
- INT iCurSel=0,tmp=0;
-
- iCurSel = (INT) SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST,
- CB_GETCURSEL,
- 0,
- 0);
- if (iCurSel == CB_ERR)
- return;
+ INT iCurSel=0,tmp=0;
+
+ iCurSel = (INT) SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST,
+ CB_GETCURSEL,
+ 0,
+ 0);
+ if (iCurSel == CB_ERR)
+ return;
tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST,
- CB_GETCURSEL,
- 0,
- (LPARAM)0);
- if (tmp > 0 && tmp < 16)
- {
- gPP[iCurSel].user.VideoTimeoutAc = Sec[tmp];
- }
+ CB_GETCURSEL,
+ 0,
+ (LPARAM)0);
+ if (tmp > 0 && tmp < 16)
+ {
+ gPP[iCurSel].user.VideoTimeoutAc = Sec[tmp];
+ }
tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST,
- CB_GETCURSEL,
- 0,
- (LPARAM)0);
- if (tmp > 0 && tmp < 16)
- {
- gPP[iCurSel].user.VideoTimeoutDc = Sec[tmp];
- }
+ CB_GETCURSEL,
+ 0,
+ (LPARAM)0);
+ if (tmp > 0 && tmp < 16)
+ {
+ gPP[iCurSel].user.VideoTimeoutDc = Sec[tmp];
+ }
tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_DISKACLIST,
- CB_GETCURSEL,
- 0,
- (LPARAM)0);
- if (tmp > 0 && tmp < 16)
- {
- gPP[iCurSel].user.SpindownTimeoutAc = Sec[tmp+2];
- }
+ CB_GETCURSEL,
+ 0,
+ (LPARAM)0);
+ if (tmp > 0 && tmp < 16)
+ {
+ gPP[iCurSel].user.SpindownTimeoutAc = Sec[tmp+2];
+ }
tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_DISKDCLIST,
- CB_GETCURSEL,
- 0,
- (LPARAM)0);
- if (tmp > 0 && tmp < 16)
- {
- gPP[iCurSel].user.SpindownTimeoutDc = Sec[tmp+2];
- }
+ CB_GETCURSEL,
+ 0,
+ (LPARAM)0);
+ if (tmp > 0 && tmp < 16)
+ {
+ gPP[iCurSel].user.SpindownTimeoutDc = Sec[tmp+2];
+ }
tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_STANDBYACLIST,
- CB_GETCURSEL,
- 0,
- (LPARAM)0);
- if (tmp > 0 && tmp < 16)
- {
- gPP[iCurSel].user.IdleTimeoutAc = Sec[tmp];
- }
+ CB_GETCURSEL,
+ 0,
+ (LPARAM)0);
+ if (tmp > 0 && tmp < 16)
+ {
+ gPP[iCurSel].user.IdleTimeoutAc = Sec[tmp];
+ }
tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_STANDBYDCLIST,
- CB_GETCURSEL,
- 0,
- (LPARAM)0);
- if (tmp > 0 && tmp < 16)
- {
- gPP[iCurSel].user.IdleTimeoutDc = Sec[tmp];
- }
+ CB_GETCURSEL,
+ 0,
+ (LPARAM)0);
+ if (tmp > 0 && tmp < 16)
+ {
+ gPP[iCurSel].user.IdleTimeoutDc = Sec[tmp];
+ }
tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_HYBERNATEACLIST,
- CB_GETCURSEL,
- 0,
- (LPARAM)0);
- if (tmp > 0 && tmp < 16)
- {
- gPP[iCurSel].mach.DozeS4TimeoutAc = Sec[tmp];
- }
+ CB_GETCURSEL,
+ 0,
+ (LPARAM)0);
+ if (tmp > 0 && tmp < 16)
+ {
+ gPP[iCurSel].mach.DozeS4TimeoutAc = Sec[tmp];
+ }
tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_HYBERNATEDCLIST,
- CB_GETCURSEL,
- 0,
- (LPARAM)0);
- if (tmp > 0 && tmp < 16)
- {
- gPP[iCurSel].mach.DozeS4TimeoutDc = Sec[tmp];
- }
+ CB_GETCURSEL,
+ 0,
+ (LPARAM)0);
+ if (tmp > 0 && tmp < 16)
+ {
+ gPP[iCurSel].mach.DozeS4TimeoutDc = Sec[tmp];
+ }
SetActivePwrScheme(iCurSel,NULL,&gPP[iCurSel]);
- LoadConfig(hwndDlg);
+ LoadConfig(hwndDlg);
}
static BOOLEAN
DelScheme(HWND hwnd)
{
- INT iCurSel;
- HWND hList;
- TCHAR szBuf[1024], szBufT[1024];
- UINT DelScheme;
-
- hList = GetDlgItem(hwnd, IDC_ENERGYLIST);
-
- iCurSel = SendMessage(hList, CB_GETCURSEL, 0, 0);
- if (iCurSel == CB_ERR) return FALSE;
-
- SendMessage(hList, CB_SETCURSEL, iCurSel, 0);
-
- DelScheme = SendMessage(hList, CB_GETITEMDATA, (WPARAM)iCurSel, 0);
- if (DelScheme == (UINT)CB_ERR) return FALSE;
-
- LoadString(hApplet, IDS_DEL_SCHEME_TITLE, szBufT, sizeof(szBufT) / sizeof(TCHAR));
- LoadString(hApplet, IDS_DEL_SCHEME, szBuf, sizeof(szBuf) / sizeof(TCHAR));
-
- if (MessageBox(hwnd, szBuf, szBufT, MB_YESNO | MB_ICONQUESTION) == IDYES)
- {
- UINT Current;
-
- if (GetActivePwrScheme(&Current))
- {
- SendMessage(hList, CB_SETCURSEL, (WPARAM)0, 0);
- SendMessage(hList, CB_DELETESTRING, (WPARAM)iCurSel, 0);
- if (Current == DelScheme) Pos_SaveData(hwnd);
- }
-
- if (DeletePwrScheme(DelScheme) != 0) return TRUE;
- }
-
- return FALSE;
+ INT iCurSel;
+ HWND hList;
+ TCHAR szBuf[1024], szBufT[1024];
+ UINT DelScheme;
+
+ hList = GetDlgItem(hwnd, IDC_ENERGYLIST);
+
+ iCurSel = SendMessage(hList, CB_GETCURSEL, 0, 0);
+ if (iCurSel == CB_ERR) return FALSE;
+
+ SendMessage(hList, CB_SETCURSEL, iCurSel, 0);
+
+ DelScheme = SendMessage(hList, CB_GETITEMDATA, (WPARAM)iCurSel, 0);
+ if (DelScheme == (UINT)CB_ERR) return FALSE;
+
+ LoadString(hApplet, IDS_DEL_SCHEME_TITLE, szBufT, sizeof(szBufT) / sizeof(TCHAR));
+ LoadString(hApplet, IDS_DEL_SCHEME, szBuf, sizeof(szBuf) / sizeof(TCHAR));
+
+ if (MessageBox(hwnd, szBuf, szBufT, MB_YESNO | MB_ICONQUESTION) == IDYES)
+ {
+ UINT Current;
+
+ if (GetActivePwrScheme(&Current))
+ {
+ SendMessage(hList, CB_SETCURSEL, (WPARAM)0, 0);
+ SendMessage(hList, CB_DELETESTRING, (WPARAM)iCurSel, 0);
+ if (Current == DelScheme) Pos_SaveData(hwnd);
+ }
+
+ if (DeletePwrScheme(DelScheme) != 0) return TRUE;
+ }
+
+ return FALSE;
}
static BOOLEAN
CreateEnergyList(HWND hwnd)
{
- BOOLEAN retval;
- POWER_POLICY pp;
- SYSTEM_POWER_CAPABILITIES spc;
-
- hList = hwnd;
-
- if (!GetActivePwrScheme(&aps))
- return FALSE;
-
- if (!ReadGlobalPwrPolicy(&gGPP))
- return FALSE;
-
- if (!ReadPwrScheme(aps,&pp))
- return FALSE;
-
- if (!ValidatePowerPolicies(&gGPP,0))
- return FALSE;
+ BOOLEAN retval;
+ POWER_POLICY pp;
+ SYSTEM_POWER_CAPABILITIES spc;
+
+ hList = hwnd;
+
+ if (!GetActivePwrScheme(&aps))
+ return FALSE;
+
+ if (!ReadGlobalPwrPolicy(&gGPP))
+ return FALSE;
+
+ if (!ReadPwrScheme(aps,&pp))
+ return FALSE;
+
+ if (!ValidatePowerPolicies(&gGPP,0))
+ return FALSE;
/*
- if (!SetActivePwrScheme(aps,&gGPP,&pp))
- return FALSE;
+ if (!SetActivePwrScheme(aps,&gGPP,&pp))
+ return FALSE;
*/
- if (!GetPwrCapabilities(&spc))
- return FALSE;
-
- if (CanUserWritePwrScheme())
- {
- // TODO:
- // Enable write / delete powerscheme button
- }
-
- Pos_InitPage(GetParent(hwnd));
-
- if (!GetActivePwrScheme(&aps))
- return FALSE;
-
- retval = EnumPwrSchemes(callback_EnumPwrScheme, aps);
+ if (!GetPwrCapabilities(&spc))
+ return FALSE;
+
+ if (CanUserWritePwrScheme())
+ {
+ // TODO:
+ // Enable write / delete powerscheme button
+ }
+
+ Pos_InitPage(GetParent(hwnd));
+
+ if (!GetActivePwrScheme(&aps))
+ return FALSE;
+
+ retval = EnumPwrSchemes(callback_EnumPwrScheme, aps);
if(SendMessage(hwnd, CB_GETCOUNT, 0, 0) > 0)
{
EnableWindow(GetDlgItem(hwndDialog, IDC_DELETE_BTN),TRUE);
- EnableWindow(GetDlgItem(hwndDialog, IDC_SAVEAS_BTN),TRUE);
- }
-
- return retval;
+ EnableWindow(GetDlgItem(hwndDialog, IDC_SAVEAS_BTN),TRUE);
+ }
+
+ return retval;
}
@@ -553,69 +553,69 @@
switch(uMsg)
{
case WM_INITDIALOG:
- hPos = hwndDlg;
- hwndDialog = hwndDlg;
- if (!Pos_InitData())
- {
- // TODO:
- // Initialization failed
- // Handle error
- MessageBox(hwndDlg,_T("Pos_InitData failed\n"), NULL, MB_OK);
-
- }
- if (!CreateEnergyList(GetDlgItem(hwndDlg, IDC_ENERGYLIST)))
- {
- // TODO:
- // Initialization failed
- // Handle error
- MessageBox(hwndDlg,_T("CreateEnergyList failed\n"), NULL, MB_OK);
- }
- return TRUE;
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case IDC_ENERGYLIST:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- LoadConfig(hwndDlg);
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
- break;
- case IDC_DELETE_BTN:
- {
- DelScheme(hwndDlg);
- }
- break;
- case IDC_SAVEAS_BTN:
- {
-
- }
- break;
- case IDC_MONITORACLIST:
- case IDC_MONITORDCLIST:
- case IDC_DISKACLIST:
- case IDC_DISKDCLIST:
- case IDC_STANDBYACLIST:
- case IDC_STANDBYDCLIST:
- case IDC_HYBERNATEACLIST:
- case IDC_HYBERNATEDCLIST:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- }
- break;
- }
- break;
- case WM_NOTIFY:
- {
- LPNMHDR lpnm = (LPNMHDR)lParam;
- if (lpnm->code == (UINT)PSN_APPLY)
- {
- Pos_SaveData(hwndDlg);
- }
- return TRUE;
- }
- break;
+ hPos = hwndDlg;
+ hwndDialog = hwndDlg;
+ if (!Pos_InitData())
+ {
+ // TODO:
+ // Initialization failed
+ // Handle error
+ MessageBox(hwndDlg,_T("Pos_InitData failed\n"), NULL, MB_OK);
+
+ }
+ if (!CreateEnergyList(GetDlgItem(hwndDlg, IDC_ENERGYLIST)))
+ {
+ // TODO:
+ // Initialization failed
+ // Handle error
+ MessageBox(hwndDlg,_T("CreateEnergyList failed\n"), NULL, MB_OK);
+ }
+ return TRUE;
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDC_ENERGYLIST:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ LoadConfig(hwndDlg);
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ break;
+ case IDC_DELETE_BTN:
+ {
+ DelScheme(hwndDlg);
+ }
+ break;
+ case IDC_SAVEAS_BTN:
+ {
+
+ }
+ break;
+ case IDC_MONITORACLIST:
+ case IDC_MONITORDCLIST:
+ case IDC_DISKACLIST:
+ case IDC_DISKDCLIST:
+ case IDC_STANDBYACLIST:
+ case IDC_STANDBYDCLIST:
+ case IDC_HYBERNATEACLIST:
+ case IDC_HYBERNATEDCLIST:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ break;
+ }
+ break;
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnm = (LPNMHDR)lParam;
+ if (lpnm->code == (UINT)PSN_APPLY)
+ {
+ Pos_SaveData(hwndDlg);
+ }
+ return TRUE;
+ }
+ break;
}
return FALSE;
}