Determining if a laptop has AC power



Legacy
07-10-2005, 12:25 AM
Hey guys... we are preparing remote installations of Windows XP SP2 for 15k+
laptops... at issue is the AC power... we have been using the key:

HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray\Services

Historically, for us, a value of 30 means on AC, 31 means not on AC.

However, all of a sudden, as we reach final stages of development, we find
some machines aren't adhering to this... and multiple types of laptops.

Is there a BETTER key/method?

Thanks in advance.

(Long time listener, first time caller)

bumtracks
07-10-2005, 12:26 AM
plug in & boot off a knoppix CD and it magically knows without lookin in
the hard drive or in windows registry if you're on battery or not.

windows somewhere tells me my laptops state of dock is unknown,
and wants me to tell it if its running on battery or not.
It's the only 'I don't know' checkbox I've ever seen auto configured.



"Legacy" <Legacy@discussions.microsoft.com> wrote in message
news:B05406A8-9A09-44A6-9B16-C8C3BA1A9F4B@microsoft.com...
> Hey guys... we are preparing remote installations of Windows XP SP2 for
> 15k+
> laptops... at issue is the AC power... we have been using the key:
>
> HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray\Services
>
> Historically, for us, a value of 30 means on AC, 31 means not on AC.
>
> However, all of a sudden, as we reach final stages of development, we find
> some machines aren't adhering to this... and multiple types of laptops.
>
> Is there a BETTER key/method?
>
> Thanks in advance.
>
> (Long time listener, first time caller)

Legacy
07-10-2005, 12:27 AM
Thanks for the reply. Unfortunately, that doesn't help me. If I was there
to place a CD in 15k+ drives, I'd be able to see if it was plugged in. I
need to have a registry key to be able to determine (scriptomatically) if it
has AC power or not. This will be an automated rollout. The end user just
puts the DVD in the drive, and off go all the updates...

"bumtracks" wrote:

> plug in & boot off a knoppix CD and it magically knows without lookin in
> the hard drive or in windows registry if you're on battery or not.
>
> windows somewhere tells me my laptops state of dock is unknown,
> and wants me to tell it if its running on battery or not.
> It's the only 'I don't know' checkbox I've ever seen auto configured.
>
>
>
> "Legacy" <Legacy@discussions.microsoft.com> wrote in message
> news:B05406A8-9A09-44A6-9B16-C8C3BA1A9F4B@microsoft.com...
> > Hey guys... we are preparing remote installations of Windows XP SP2 for
> > 15k+
> > laptops... at issue is the AC power... we have been using the key:
> >
> > HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray\Services
> >
> > Historically, for us, a value of 30 means on AC, 31 means not on AC.
> >
> > However, all of a sudden, as we reach final stages of development, we find
> > some machines aren't adhering to this... and multiple types of laptops.
> >
> > Is there a BETTER key/method?
> >
> > Thanks in advance.
> >
> > (Long time listener, first time caller)
>
>
>

David Candy
07-10-2005, 12:27 AM
Platform SDK: Hardware

GetSystemPowerStatus
The GetSystemPowerStatus function retrieves the power status of the system. The status indicates whether the system is running on AC or DC power, whether the battery is currently charging, and how much battery life remains.

BOOL GetSystemPowerStatus(
LPSYSTEM_POWER_STATUS lpSystemPowerStatus
);Parameters
lpSystemPowerStatus
[out] Pointer to a SYSTEM_POWER_STATUS structure that receives status information.
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.

See Also
Power Management Overview, Power Management Functions, SYSTEM_POWER_STATUS


Platform SDK Release: August 2001 What did you think of this topic?
Let us know. Order a Platform SDK CD Online
(U.S/Canada) (International)



Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.

See Also
Power Management Overview, Power Management Functions, SYSTEM_POWER_STATUS


--
----------------------------------------------------------

"Legacy" <Legacy@discussions.microsoft.com> wrote in message news:91C0BA64-43B6-4128-AFD4-1E33A645770A@microsoft.com...
> Thanks for the reply. Unfortunately, that doesn't help me. If I was there
> to place a CD in 15k+ drives, I'd be able to see if it was plugged in. I
> need to have a registry key to be able to determine (scriptomatically) if it
> has AC power or not. This will be an automated rollout. The end user just
> puts the DVD in the drive, and off go all the updates...
>
> "bumtracks" wrote:
>
>> plug in & boot off a knoppix CD and it magically knows without lookin in
>> the hard drive or in windows registry if you're on battery or not.
>>
>> windows somewhere tells me my laptops state of dock is unknown,
>> and wants me to tell it if its running on battery or not.
>> It's the only 'I don't know' checkbox I've ever seen auto configured.
>>
>>
>>
>> "Legacy" <Legacy@discussions.microsoft.com> wrote in message
>> news:B05406A8-9A09-44A6-9B16-C8C3BA1A9F4B@microsoft.com...
>> > Hey guys... we are preparing remote installations of Windows XP SP2 for
>> > 15k+
>> > laptops... at issue is the AC power... we have been using the key:
>> >
>> > HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray\Services
>> >
>> > Historically, for us, a value of 30 means on AC, 31 means not on AC.
>> >
>> > However, all of a sudden, as we reach final stages of development, we find
>> > some machines aren't adhering to this... and multiple types of laptops.
>> >
>> > Is there a BETTER key/method?
>> >
>> > Thanks in advance.
>> >
>> > (Long time listener, first time caller)
>>
>>
>>

Legacy
07-10-2005, 12:31 AM
I was looking for a much simpler way... nothing as simple as a status in the
registry somewhere? I would hate to have to add more code to make this work.
Might have to just give a warning that it "should be plugged in", and hope
it is.

"David Candy" wrote:

>
>
> Platform SDK: Hardware
>
> GetSystemPowerStatus
> The GetSystemPowerStatus function retrieves the power status of the system. The status indicates whether the system is running on AC or DC power, whether the battery is currently charging, and how much battery life remains.
>
> BOOL GetSystemPowerStatus(
> LPSYSTEM_POWER_STATUS lpSystemPowerStatus
> );Parameters
> lpSystemPowerStatus
> [out] Pointer to a SYSTEM_POWER_STATUS structure that receives status information.
> Return Values
> If the function succeeds, the return value is nonzero.
>
> If the function fails, the return value is zero. To get extended error information, call GetLastError.
>
> Requirements
> Windows NT/2000/XP: Included in Windows 2000 and later.
> Windows 95/98/Me: Included in Windows 95 and later.
> Header: Declared in Winbase.h; include Windows.h.
> Library: Use Kernel32.lib.
>
> See Also
> Power Management Overview, Power Management Functions, SYSTEM_POWER_STATUS
>
>
> Platform SDK Release: August 2001 What did you think of this topic?
> Let us know. Order a Platform SDK CD Online
> (U.S/Canada) (International)
>
>
>
> Requirements
> Windows NT/2000/XP: Included in Windows 2000 and later.
> Windows 95/98/Me: Included in Windows 95 and later.
> Header: Declared in Winbase.h; include Windows.h.
> Library: Use Kernel32.lib.
>
> See Also
> Power Management Overview, Power Management Functions, SYSTEM_POWER_STATUS
>
>
> --
> ----------------------------------------------------------
>
> "Legacy" <Legacy@discussions.microsoft.com> wrote in message news:91C0BA64-43B6-4128-AFD4-1E33A645770A@microsoft.com...
> > Thanks for the reply. Unfortunately, that doesn't help me. If I was there
> > to place a CD in 15k+ drives, I'd be able to see if it was plugged in. I
> > need to have a registry key to be able to determine (scriptomatically) if it
> > has AC power or not. This will be an automated rollout. The end user just
> > puts the DVD in the drive, and off go all the updates...
> >
> > "bumtracks" wrote:
> >
> >> plug in & boot off a knoppix CD and it magically knows without lookin in
> >> the hard drive or in windows registry if you're on battery or not.
> >>
> >> windows somewhere tells me my laptops state of dock is unknown,
> >> and wants me to tell it if its running on battery or not.
> >> It's the only 'I don't know' checkbox I've ever seen auto configured.
> >>
> >>
> >>
> >> "Legacy" <Legacy@discussions.microsoft.com> wrote in message
> >> news:B05406A8-9A09-44A6-9B16-C8C3BA1A9F4B@microsoft.com...
> >> > Hey guys... we are preparing remote installations of Windows XP SP2 for
> >> > 15k+
> >> > laptops... at issue is the AC power... we have been using the key:
> >> >
> >> > HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray\Services
> >> >
> >> > Historically, for us, a value of 30 means on AC, 31 means not on AC.
> >> >
> >> > However, all of a sudden, as we reach final stages of development, we find
> >> > some machines aren't adhering to this... and multiple types of laptops.
> >> >
> >> > Is there a BETTER key/method?
> >> >
> >> > Thanks in advance.
> >> >
> >> > (Long time listener, first time caller)
> >>
> >>
> >>


Determining if a laptop has AC power