|
|
|
|
#1 |
|
Junior Member
Join Date: Sep 2009
Posts: 17
|
How to check power supply plugged?
Hello everybody,
I'm looking for a way to check if the power supply of a leptop is plugged when then user runs installer. I'm not "fluent" in NSIS language, and at this time i've found nothing to help me. |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
You need to use the system plugin to call the API command GetSystemPowerStatus() in Kernel32.dll. See:
http://nsis.sourceforge.net/Docs/Sys...html#callfuncs And: http://msdn.microsoft.com/en-us/libr...93(VS.85).aspx |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Sep 2009
Posts: 17
|
Thank You for links.
But i'm still lost... I don't understand the parameter I have to give to the Proc. I'm so sorry. |
|
|
|
|
|
#4 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
code: See for details on the possible values: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx If you want to know how this works, take a close look at the system plugin readme I linked to. It allocates memory for a SYSTEM_POWER_STATUS structure, then calls the GetSystemPowerStatus function. It then disassembles the structure into four 1-byte integers and two DWORDS (which are 4 bytes each). (Props to Anders for teaching me how to use these things.) |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Sep 2009
Posts: 17
|
Hello MSG,
thank you for this snippet. I didn't understand that I have to allocate memory before the call. Anyway, You right when you say I have to take a closer look to the msdn page. (Sorry for my english I'm not fluent in this language too) |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|