#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Power API

I am building an Excel alarm clock for a laptop. I am updating the display
with an OnTime event. One of the requirements is to autonomously detect if
the laptop switches from A/C power to its internal battery.

Has anyone come across an API that will return the power state? Say TRUE if
A/C, FALSE if battery?

Thanks for any leads.
--
Gary''s Student - gsnu200766
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Power API

Maybe...

Private Declare Function GetDevicePowerState Lib "kernel32.dll" _
(ByVal hDevice As Long, ByRef pfOn As Long) As Long
http://msdn2.microsoft.com/en-us/library/aa372690.aspx

Private Declare Function GetSystemPowerStatus Lib "kernel32.dll" _
(ByRef lpSystemPowerStatus As SYSTEM_POWER_STATUS) As Long
http://msdn2.microsoft.com/en-us/lib...93(VS.85).aspx

--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Gary''s Student"
wrote in message
I am building an Excel alarm clock for a laptop. I am updating the display
with an OnTime event. One of the requirements is to autonomously detect if
the laptop switches from A/C power to its internal battery.

Has anyone come across an API that will return the power state? Say TRUE if
A/C, FALSE if battery?
Thanks for any leads.
--
Gary''s Student - gsnu200766
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Power API

Actually this looks to be the link and it contains some more info, about 2/3
the way down.

http://www.codeguru.com/forum/archiv.../t-199354.html
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Gary''s Student" wrote:

I am building an Excel alarm clock for a laptop. I am updating the display
with an OnTime event. One of the requirements is to autonomously detect if
the laptop switches from A/C power to its internal battery.

Has anyone come across an API that will return the power state? Say TRUE if
A/C, FALSE if battery?

Thanks for any leads.
--
Gary''s Student - gsnu200766

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Power API

Thank Jim (once again) !
--
Gary''s Student - gsnu200766


"Jim Cone" wrote:

Maybe...

Private Declare Function GetDevicePowerState Lib "kernel32.dll" _
(ByVal hDevice As Long, ByRef pfOn As Long) As Long
http://msdn2.microsoft.com/en-us/library/aa372690.aspx

Private Declare Function GetSystemPowerStatus Lib "kernel32.dll" _
(ByRef lpSystemPowerStatus As SYSTEM_POWER_STATUS) As Long
http://msdn2.microsoft.com/en-us/lib...93(VS.85).aspx

--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Gary''s Student"
wrote in message
I am building an Excel alarm clock for a laptop. I am updating the display
with an OnTime event. One of the requirements is to autonomously detect if
the laptop switches from A/C power to its internal battery.

Has anyone come across an API that will return the power state? Say TRUE if
A/C, FALSE if battery?
Thanks for any leads.
--
Gary''s Student - gsnu200766

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Power API

Thanks John!!
--
Gary''s Student - gsnu200766


"John Bundy" wrote:

Actually this looks to be the link and it contains some more info, about 2/3
the way down.

http://www.codeguru.com/forum/archiv.../t-199354.html
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Gary''s Student" wrote:

I am building an Excel alarm clock for a laptop. I am updating the display
with an OnTime event. One of the requirements is to autonomously detect if
the laptop switches from A/C power to its internal battery.

Has anyone come across an API that will return the power state? Say TRUE if
A/C, FALSE if battery?

Thanks for any leads.
--
Gary''s Student - gsnu200766

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ten to the power of six Corren New Users to Excel 9 April 14th 07 11:25 PM
Power and Sum John Watt Excel Worksheet Functions 6 January 4th 07 09:52 PM
Nth power dilemma Andre Croteau Excel Discussion (Misc queries) 6 June 23rd 06 09:16 PM
shortcut for x^2 (power) Khoshravan Excel Discussion (Misc queries) 10 February 28th 06 04:51 PM
how to use power point sara benson Excel Discussion (Misc queries) 2 December 12th 05 03:50 PM


All times are GMT +1. The time now is 01:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"