I am having some problems with the following code. The code runs but I only get the first letter of the strings returned. Not sure how to get the rest of the strings. And everything I try to access the PP structure seems to fail. Any help or pointers would be appreciated.
Thanks.
Code: Select all
#EnableSysTrayBatteryMeter = $01
#EnableMultiBatteryDisplay = $02
#EnablePasswordLogon = $04
#EnableWakeOnRing = $08
#EnableVideoDimDisplay = $10
#NEWSCHEME = -1
#NTSTATUS = #LONG
#NUM_DISCHARGE_POLICIES = 4
Structure PROCESSOR_POWER_POLICY_INFO
TimeCheck.l
DemoteLimit.l
PromoteLimit.l
DemotePercent.b
PromotePercent.b
Spare.b[2]
AllowDemotion:1.l
AllowPromotion:1.l
Reserved:30.l
EndStructure
Structure PROCESSOR_POWER_POLICY
Revision.l
DynamicThrottle.b
Spare.b[3]
DisableCStates:1.l
Reserved1:31.l
PolicyCount.l
Policy.PROCESSOR_POWER_POLICY_INFO[3]
EndStructure
Structure ADMINISTRATOR_POWER_POLICY
MinSleep.l
MaxSleep.l
MinVideoTimeout.l
MaxVideoTimeout.l
MinSpindownTimeout.l
MaxSpindownTimeout.l
EndStructure
Structure BATTERY_REPORTING_SCALE
Granularity.l
Capacity.l
EndStructure
Structure SYSTEM_POWER_CAPABILITIES
PowerButtonPresent.b
SleepButtonPresent.b
LidPresent.b
SystemS1.b
SystemS2.b
SystemS3.b
SystemS4.b
SystemS5.b
HiberFilePresent.b
FullWake.b
VideoDimPresent.b
ApmPresent.b
UpsPresent.b
ThermalControl.b
ProcessorThrottle.b
ProcessorMinThrottle.b
ProcessorMaxThrottle.b
spare2.b[4]
DiskSpinDown.b
spare3.b[8]
SystemBatteriesPresent.b
BatteriesAreShortTerm.b
BatteryScale.BATTERY_REPORTING_SCALE[3]
AcOnLineWake.l
SoftLidWake.l
RtcWake.l
MinDeviceWakeState.l
DefaultLowLatencyWake.l
EndStructure
Structure SYSTEM_BATTERY_STATE
AcOnLine.b
BatteryPresent.b
Charging.b
Discharging.b
Spare1.b[4]
MaxCapacity.l
RemainingCapacity.l
Rate.l
EstimatedTime.l
DefaultAlert1.l
DefaultAlert2.l
EndStructure
Structure POWER_ACTION_POLICY
Action.l
Flags.l
EventCode.l
EndStructure
Structure SYSTEM_POWER_LEVEL
Enable.b
Spare.b[3]
BatteryLevel.l
PowerPolicy.POWER_ACTION_POLICY
MinSystemState.l
EndStructure
Structure GLOBAL_MACHINE_POWER_POLICY
Revision.l
LidOpenWakeAc.l
LidOpenWakeDc.l
BroadcastCapacityResolution.l
EndStructure
Structure GLOBAL_USER_POWER_POLICY
Revision.l
PowerButtonAc.POWER_ACTION_POLICY
PowerButtonDc.POWER_ACTION_POLICY
SleepButtonAc.POWER_ACTION_POLICY
SleepButtonDc.POWER_ACTION_POLICY
LidCloseAc.POWER_ACTION_POLICY
LidCloseDc.POWER_ACTION_POLICY
DischargePolicy.SYSTEM_POWER_LEVEL[#NUM_DISCHARGE_POLICIES]
GlobalFlags.l
EndStructure
Structure GLOBAL_POWER_POLICY
user.GLOBAL_USER_POWER_POLICY
mach.GLOBAL_MACHINE_POWER_POLICY
EndStructure
Structure MACHINE_POWER_POLICY
Revision.l
MinSleepAc.l
MinSleepDc.l
ReducedLatencySleepAc.l
ReducedLatencySleepDc.l
DozeTimeoutAc.l
DozeTimeoutDc.l
DozeS4TimeoutAc.l
DozeS4TimeoutDc.l
MinThrottleAc.b
MinThrottleDc.b
pad1.b[2]
OverThrottledAc.POWER_ACTION_POLICY
OverThrottledDc.POWER_ACTION_POLICY
EndStructure
Structure MACHINE_PROCESSOR_POWER_POLICY
Revision.l
ProcessorPolicyAc.PROCESSOR_POWER_POLICY
ProcessorPolicyDc.PROCESSOR_POWER_POLICY
EndStructure
Structure USER_POWER_POLICY
Revision.l
IdleAc.POWER_ACTION_POLICY
IdleDc.POWER_ACTION_POLICY
IdleTimeoutAc.l
IdleTimeoutDc.l
IdleSensitivityAc.b
IdleSensitivityDc.b
ThrottlePolicyAc.b
ThrottlePolicyDc.b
MaxSleepAc.l
MaxSleepDc.l
Reserved.l[2]
VideoTimeoutAc.l
VideoTimeoutDc.l
SpindownTimeoutAc.l
SpindownTimeoutDc.l
OptimizeForPowerAc.b
OptimizeForPowerDc.b
FanThrottleToleranceAc.b
FanThrottleToleranceDc.b
ForcedThrottleAc.b
ForcedThrottleDc.b
EndStructure
Structure POWER_POLICY
user.USER_POWER_POLICY
mach.MACHINE_POWER_POLICY
EndStructure
*PP.POWER_POLICY
Procedure.l EnumPowerPolicy(Index.l, dwName.w, sName.s, dwDesc.w, sDesc.s, PP, UserDefine.l)
MessageRequester("",sName.s)
ProcedureReturn 1
EndProcedure
OpenLibrary(1,"powrprof.dll"); XP path C:\Windows\system32\powrprof.dll
Result = CallFunction(1, "EnumPwrSchemes", @EnumPowerPolicy(), 1)
CloseLibrary(1)
Not sure... I get a message that this variable does not have a structure.
Thanks Again.
Kent