Solved

Can machine suspend?

Posted on 1998-06-30
12
313 Views
Last Modified: 2013-12-03
How can it be determined if a machine is capable of suspending?
0
Comment
Question by:dmetzler
  • 5
  • 2
  • 2
  • +3
12 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1409022
What do you mean?  Do you mean the low-power screen saver?  that can be obtained from SystemParemetersInfo().
0
 

Author Comment

by:dmetzler
ID: 1409023
No - laptop machines can suspend (sleep).  I know how to place a machine in suspend mode (if it can).  I want to query a system to see if it is capable of suspending.  (Laptop machines have an additional Start Menu item below Shutdown for Suspend)

0
 
LVL 22

Expert Comment

by:nietod
ID: 1409024
I don't see a direct way.  But if there isn't a direct way, you might try using GetSystemPowerStatus() and looking to see if the computer has a battery.
0
 
LVL 2

Expert Comment

by:WDB
ID: 1409025
Check for the follwing Registry entry

HKEY_LOCAL_MACHINE\Enum\Root\*PNP0C05\0000\APMMenuSuspend

If it's there the system is cabable of suspending.
0
 

Author Comment

by:dmetzler
ID: 1409026
I have just checked the key on my desktop machine:

HKEY_LOCAL_MACHINE\Enum\Root\*PNP0C05\0000\APMMenuSuspend

This value shows up as 01, but this machine cannot suspend, nor does it have a Start Menu suspend option.
0
 
LVL 32

Expert Comment

by:jhance
ID: 1409027
I've not found it to be 100% reliable but the following code uses the SetSystemPowerState() function to try and do a suspend.  The problem with reliability is that not all laptops support the APM power functions.  Many provide their own interface to their own power management protocol and make it look like it's the same as Windows.  The problem is then that Windows only knows how to deal with APM.

void CRebootDialog::OnClickedSuspend()
{
    if(!SetSystemPowerState(FALSE, TRUE)){
        AfxMessageBox("Failed to initiate SUSPEND - Does your system support APM functions?");
        EndDialog(IDC_APMFAILED);
    }
    else{
        EndDialog(IDC_SUSPENDOK);
    }
}
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:dmetzler
ID: 1409028
I need to know if this available BEFORE the machine attempts to suspend, as I want to make some options unavailable.
0
 
LVL 2

Expert Comment

by:kinkajou
ID: 1409029
Use an ACCESSTIMEOUT structure when calling the SystemParametersInfo() function with the uiAction parameter set to the SPI_GETACCESSTIMEOUT. You will be interested in some of the other functions/uiAction parameters available to SystemParametersInfo().
0
 

Author Comment

by:dmetzler
ID: 1409030
The ACCESSTIMEOUT structure and SystemParametersInfo seem to be used with the accessibility features, if installed, and not for a suspend.
0
 
LVL 2

Expert Comment

by:kinkajou
ID: 1409031
The WM_POWERBROADCAST message is sent to an application to notify it of power-management events.

dwPowerEvent = (DWORD) wParam;
dwData = (DWORD) lParam;
 
PBT_APMBATTERYLOW
 Battery power is low.
 
PBT_APMOEMEVENT
 OEM-defined event occurred.
 
PBT_APMPOWERSTATUSCHANGE
 Power status has changed.
 
PBT_APMQUERYSUSPEND
 Request for permission to suspend.
 
PBT_APMQUERYSUSPENDFAILED
 Suspension request denied.
 
PBT_APMRESUMECRITICAL
 Operation resuming after critical suspension.
 
PBT_APMRESUMESUSPEND
 Operation resuming after suspension.
 
PBT_APMSUSPEND
 
Can be used to determine if a suspend is goning to occur and you have time to do work or deny the suspension with BROADCAST_QUERY_DENY.


WM_POWERBROADCAST is sent by VPOWERD.VXD. There is a discussion in the 95DDK (KERNEL.DOC) about the VPOWERD handler services. The function you would want to use is:DWORD _VPOWERD_Get_Power_Management_Level (void); that returns the power management level of the system =
0 - both bios and cooperative power management on.
1 - bios power management on.
2 - power management off.

So, use LoadLibrary() to get the VPOWERD.VXD and GetProcAddress() to get _VPOWERD_Get_Power_Management_Level() and call the address of this function to get the return.

But I haven't seen an actual function in the SDK that will get the information you want.
0
 
LVL 2

Accepted Solution

by:
cessi0g earned 100 total points
ID: 1409032
You need to use VESA DPMS/VBE standars.
Try to use int 10h, with AX=4f10h and BX = 0.

Look at www.ctyme.com/intr/RB-0273.HTM
0
 

Author Comment

by:dmetzler
ID: 1409033
Great!  Thanks!

Don
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now