Use this struct : SYSTEM_POWER_STATUS, and check the value of ACLineStatus
field.
- ACLineStatus = 0 => The system is not using AC power > Laptop + battery
- ACLineStatus = 1 => The system is using AC power => Laptop + AC
- ACLineStatus = 255 => AC power status is unknown => Desktop
Disclaimer : Try experimenting with these. I'm not claiming if they're reliable. But they're almost correct.
--
EDIT:
Use GetSystemPowerStatus to get the value of the above mentioned structure.
By the way, you can also experiment with the other fields of the structure; maybe you can find some useful pattern, giving you some combination of values of different fields to help you reliably detect if application is running on laptop or not.