🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3595

SetSystemPowerState issues

#3595
From: Mike Collins
Date: Fri, 19 May 2006 15:46
39 lines
2904 bytes
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 
Technical Details
Message-ID: <446de84c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a40f30873ebce91c,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mike Collins" <its@TheBottomOfThePost.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: SetSystemPowerState issues
Date: Fri, 19 May 2006 16:46:17 +0100
Lines: 41
Organization: SDA Ltd
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.2663
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663
NNTP-Posting-Host: 81.2.92.14
Message-ID: <446de84c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1148053580 81.2.92.14 (19 May 2006 08:46:20 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail