Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to determine whether the computer supports hibernation, the sleep states Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
05-Apr-03
Category
System
Language
Delphi 3.x
Views
160
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Lou Adler 

How to determine whether the computer supports hibernation, the sleep states

Answer:

Check if hibernation is allowed 

1   function HibernateAllowed: Boolean;
2   type
3     TIsPwrHibernateAllowed = function: Boolean;
4     stdcall;
5   var
6     hPowrprof: HMODULE;
7     IsPwrHibernateAllowed: TIsPwrHibernateAllowed;
8   begin
9     Result := False;
10    if IsNT4Or95 then
11      Exit;
12    hPowrprof := LoadLibrary('powrprof.dll');
13    if hPowrprof <> 0 then
14    begin
15      try
16        @IsPwrHibernateAllowed := GetProcAddress(hPowrprof, 'IsPwrHibernateAllowed');
17        if @IsPwrHibernateAllowed <> nil then
18        begin
19          Result := IsPwrHibernateAllowed;
20        end;
21      finally
22        FreeLibrary(hPowrprof);
23      end;
24    end;
25  end;
26  
27  //Check if suspend is allowed 
28  
29  function SuspendAllowed: Boolean;
30  type
31    TIsPwrSuspendAllowed = function: Boolean;
32    stdcall;
33  var
34    hPowrprof: HMODULE;
35    IsPwrSuspendAllowed: TIsPwrSuspendAllowed;
36  begin
37    Result := False;
38    hPowrprof := LoadLibrary('powrprof.dll');
39    if hPowrprof <> 0 then
40    begin
41      try
42        @IsPwrSuspendAllowed := GetProcAddress(hPowrprof, 'IsPwrSuspendAllowed');
43        if @IsPwrSuspendAllowed <> nil then
44        begin
45          Result := IsPwrSuspendAllowed;
46        end;
47      finally
48        FreeLibrary(hPowrprof);
49      end;
50    end;
51  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC