Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Can machine suspend?

Posted on 1998-06-30
12
Medium Priority
?
325 Views
Last Modified: 2013-12-03
How can it be determined if a machine is capable of suspending?
0
Comment
Question by:dmetzler
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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
 

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 400 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 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