static POWER_ACTION g_SleepButton[5];
+static
+VOID
+SetSystrayPowerIconState(BOOL bEnabled)
+{
+ HWND hwndTaskBar;
+
+ hwndTaskBar = FindWindowW(L"SystemTray_Main", NULL);
+ if (hwndTaskBar == NULL)
+ return;
+
+ SendMessageW(hwndTaskBar, WM_USER + 220, 1, bEnabled);
+}
+
+static
+BOOL
+GetSystrayPowerIconState(VOID)
+{
+ HWND hwndTaskBar;
+
+ hwndTaskBar = FindWindowW(L"SystemTray_Main", NULL);
+ if (hwndTaskBar == NULL)
+ return FALSE;
+
+ return (BOOL)SendMessageW(hwndTaskBar, WM_USER + 221, 1, 0);
+}
+
static VOID
AddItem(HWND hDlgCtrl, INT ResourceId, LPARAM lParam, POWER_ACTION * lpAction)
{
if (!IsBatteryUsed())
{
#if 0
- /* expiremental code */
+ /* experimental code */
// ShowCurrentPowerButtonAcAction(hList2,
ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON),
g_SystemBatteries,
&gGPP.user.PowerButtonAc);
#if 0
- /* expiremental code */
+ /* experimental code */
ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON),
g_SleepButton,
sizeof(g_SleepButton) / sizeof(POWER_ACTION),
SYSTEM_POWER_CAPABILITIES spc;
+ if (GetSystrayPowerIconState())
+ gGPP.user.GlobalFlags |= EnableSysTrayBatteryMeter;
+ else
+ gGPP.user.GlobalFlags &= ~EnableSysTrayBatteryMeter;
+
CheckDlgButton(hAdv,
IDC_SYSTRAYBATTERYMETER,
gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter ? BST_CHECKED : BST_UNCHECKED);
ShowWindow(hList2, FALSE);
}
- hList3=GetDlgItem(hAdv, IDC_SLEEPBUTTON);
+ hList3 = GetDlgItem(hAdv, IDC_SLEEPBUTTON);
SendMessage(hList3, CB_RESETCONTENT, 0, 0);
memset(g_SleepButton, 0x0, sizeof(g_SleepButton));
MessageBox(hwndDlg, L"WriteGlobalPwrPolicy failed", NULL, MB_OK);
}
+ SetSystrayPowerIconState(!bSystrayBatteryMeter);
+
Adv_InitDialog();
}