mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:05:49 +00:00
[POWERCFG]
Show and hide the power systray icon. svn path=/trunk/; revision=74226
This commit is contained in:
parent
a9265410de
commit
3bce3e3e48
1 changed files with 34 additions and 1 deletions
|
@ -18,6 +18,32 @@ static POWER_ACTION g_PowerButton[5];
|
|||
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)
|
||||
{
|
||||
|
@ -278,6 +304,11 @@ Adv_InitDialog(VOID)
|
|||
|
||||
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);
|
||||
|
@ -351,7 +382,7 @@ Adv_InitDialog(VOID)
|
|||
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));
|
||||
|
||||
|
@ -470,6 +501,8 @@ Adv_SaveData(HWND hwndDlg)
|
|||
MessageBox(hwndDlg, L"WriteGlobalPwrPolicy failed", NULL, MB_OK);
|
||||
}
|
||||
|
||||
SetSystrayPowerIconState(!bSystrayBatteryMeter);
|
||||
|
||||
Adv_InitDialog();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue