mirror of
https://github.com/reactos/reactos.git
synced 2024-08-24 12:18:57 +00:00
- Don't change the current power scheme when displaying the dialog
- Load additional pages provided by shell extensions svn path=/trunk/; revision=29146
This commit is contained in:
parent
2018d3408d
commit
6897e5ee5a
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
#include <shlobj.h>
|
||||||
|
#include <regstr.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -79,15 +81,30 @@ PropSheetProc(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL CALLBACK
|
||||||
|
PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
|
||||||
|
{
|
||||||
|
PROPSHEETHEADER *ppsh = (PROPSHEETHEADER *)lParam;
|
||||||
|
if (ppsh != NULL && ppsh->nPages < MAX_POWER_PAGES)
|
||||||
|
{
|
||||||
|
ppsh->phpage[ppsh->nPages++] = hpage;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* First Applet */
|
/* First Applet */
|
||||||
static LONG APIENTRY
|
static LONG APIENTRY
|
||||||
Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
PROPSHEETPAGE psp[5];
|
PROPSHEETPAGE psp[MAX_POWER_PAGES];
|
||||||
PROPSHEETHEADER psh;
|
PROPSHEETHEADER psh;
|
||||||
|
HPSXA hpsxa = NULL;
|
||||||
TCHAR Caption[1024];
|
TCHAR Caption[1024];
|
||||||
SYSTEM_POWER_CAPABILITIES spc;
|
SYSTEM_POWER_CAPABILITIES spc;
|
||||||
INT i=0;
|
INT i=0;
|
||||||
|
LONG ret;
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(hwnd);
|
UNREFERENCED_PARAMETER(hwnd);
|
||||||
UNREFERENCED_PARAMETER(uMsg);
|
UNREFERENCED_PARAMETER(uMsg);
|
||||||
|
@ -121,7 +138,17 @@ Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
||||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGEADVANCED, (DLGPROC) advancedProc);
|
InitPropSheetPage(&psp[i++], IDD_PROPPAGEADVANCED, (DLGPROC) advancedProc);
|
||||||
InitPropSheetPage(&psp[i++], IDD_PROPPAGEHIBERNATE, (DLGPROC) hibernateProc);
|
InitPropSheetPage(&psp[i++], IDD_PROPPAGEHIBERNATE, (DLGPROC) hibernateProc);
|
||||||
|
|
||||||
return (LONG)(PropertySheet(&psh) != -1);
|
/* Load additional pages provided by shell extensions */
|
||||||
|
hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER TEXT("\\Power"), MAX_POWER_PAGES - psh.nPages);
|
||||||
|
if (hpsxa != NULL)
|
||||||
|
SHAddFromPropSheetExtArray(hpsxa, PropSheetAddPage, (LPARAM)&psh);
|
||||||
|
|
||||||
|
ret = (LONG)(PropertySheet(&psh) != -1);
|
||||||
|
|
||||||
|
if (hpsxa != NULL)
|
||||||
|
SHDestroyPropSheetExtArray(hpsxa);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Control Panel Callback */
|
/* Control Panel Callback */
|
||||||
|
|
|
@ -16,6 +16,8 @@ extern GLOBAL_POWER_POLICY gGPP;
|
||||||
extern POWER_POLICY gPP[];
|
extern POWER_POLICY gPP[];
|
||||||
extern UINT guiIndex;
|
extern UINT guiIndex;
|
||||||
|
|
||||||
|
#define MAX_POWER_PAGES 32
|
||||||
|
|
||||||
#endif /* __CPL_SAMPLE_H */
|
#endif /* __CPL_SAMPLE_H */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
<library>powrprof</library>
|
<library>powrprof</library>
|
||||||
<library>comctl32</library>
|
<library>comctl32</library>
|
||||||
|
<library>shell32</library>
|
||||||
<library>msvcrt</library>
|
<library>msvcrt</library>
|
||||||
<file>powercfg.c</file>
|
<file>powercfg.c</file>
|
||||||
<file>powershemes.c</file>
|
<file>powershemes.c</file>
|
||||||
|
|
|
@ -287,8 +287,10 @@ BOOLEAN CreateEnergyList(HWND hwnd)
|
||||||
if (!ValidatePowerPolicies(&gGPP,0))
|
if (!ValidatePowerPolicies(&gGPP,0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
if (!SetActivePwrScheme(aps,&gGPP,&pp))
|
if (!SetActivePwrScheme(aps,&gGPP,&pp))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
*/
|
||||||
|
|
||||||
if (!GetPwrCapabilities(&spc))
|
if (!GetPwrCapabilities(&spc))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue