![]() |
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. |
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 |
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. |
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.) |
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) |
| All times are GMT. The time now is 17:24. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.