Results 1 to 5 of 5
  1. #1
    Newbie
    Overall activity: 0%

    Join Date
    Jun 2008
    Posts
    3
    Liked
    0 times
    Points
    2,837
    Hello,
    I need to prevent the system get shouted down or locked when pressing POWER or SLEEP button. It should be done from a program - not by changing settings from Control Panel or mmc console. I wrote a simple kbd hook, catch vk_sleep and did not pass it further on in chain, but only this does not works - the system was locked, nevertheless log file points the key was caught?!
    Can anybody help me on this ? tnx!!!

  2. #2
    Administrator
    Overall activity: 61.0%

    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    9,803
    Liked
    1656 times
    Points
    48,748
    Are you asking help on programming? Or a program to disable the sleep and power button on keyboard?

    Here are some programs which you can disable the sleep and power keys.
    http://www.raymond.cc/blog/archives/2007/12/12/make-certain-keys-on-a-keyboard-to-act-like-other-keys/

  3. #3
    Newbie
    Overall activity: 0%

    Join Date
    Jun 2008
    Posts
    3
    Liked
    0 times
    Points
    2,837
    Hello Raymond - thanks for your replay - I need source example or hint? The situation is such that I can not use your excellent tools ...

  4. #4
    Administrator
    Overall activity: 61.0%

    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    9,803
    Liked
    1656 times
    Points
    48,748
    Sorry, I can't help you in programming :P
    I am a tech guy.

  5. #5
    Newbie
    Overall activity: 0%

    Join Date
    Jun 2008
    Posts
    3
    Liked
    0 times
    Points
    2,837
    For those who may need to block Power and Sleep buttons from their programs :
    The solution wiht low level keyboard hook does not work on XP SP2. instead this works :


    Inside the window procedure, where you switch on message you need to handle the WM_POWERBROADCAST and return BROADCAST_QUERY_DENY to prevent system to be shut down on locked.

    Code:
    {   
         switch (message)
         {
            case WM_POWERBROADCAST:
            {
                int ret =1;
    
              if ( wParam == PBT_APMQUERYSUSPEND || wParam == PBT_APMQUERYSTANDBY )
                  return BROADCAST_QUERY_DENY; 
              else
                 return TRUE;
            }break;
       ............	
         }

 

 

Similar Threads

  1. Don't Sleep 2.28
    By ted in forum Latest Releases
    Replies: 5
    Last Post: 05-24-2011, 12:41 AM
  2. Don't Sleep 2.14
    By Boyfriend in forum Latest Releases
    Replies: 0
    Last Post: 01-29-2011, 06:33 PM
  3. Don't Sleep 2.06
    By Boyfriend in forum Latest Releases
    Replies: 2
    Last Post: 12-02-2010, 11:11 PM
  4. Don't Sleep
    By noaccount in forum Chat
    Replies: 15
    Last Post: 04-27-2010, 12:41 PM
  5. Replies: 4
    Last Post: 02-08-2008, 01:17 AM
All times are GMT +8. The time now is 09:27 AM.