Board index » cppbuilder » SetSystemPowerState issues
Mike Collins
CBuilder Developer |
SetSystemPowerState issues2006-05-19 11:46:17 PM cppbuilder48 Hi guys - it must be bug Friday for me today, two posts in a row. Having another issue, this time relating to SetSystemPowerState(). In our application be have a system, similar to the Microsoft shutdown dialog where the user can choose how they want to close the Windows session i.e. restart, shutdown, hibernate or stand-by. All options seem to work except the hibernate / stand-by. The only way i could find to implement either of these was with SetSystemPowerState(). However I have discovered that on some systems you do not seem to be able to place the OS in either of these states i.e. if you use the normal MS shutdown dialog it does not have either of these options available. And in following with this, if our application tried to implement a stand-by or hibernate on these systems, it causes considerable problems resulting in BSOD and system restart. What usually happens is that the system will a) display the MS shutdown message but not proceed any further, or b) appear to hibernate but not turn off the PSU / CPU fans. When (b) happens, if I try to re-activate the system using the power button, it appear to re-start and then I get a page-fault BSOD. What I need to know is, is there any way to detect or determine if the system can or can't be placed in either of theses modes? I've notices on the Windows XP Home edition shutdown that under certain circumstances and configurations, the Stand-By or Hibernate buttons may be disabled. This is exactly what I need to determine... My second question, (in following with this) is, does my application (or any other running on the system) need to perform any specialist operations before the system is suspended. For example, we have a hardware polling thread - does this need to be specifically suspended by our application or does the OS take care of these aspects? As usual, any help or pointers would be gratefully received, Many thanks in advance, Mike C |