Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. VC++ 6.0 MFC - Temp disable mouse and keyboard for 5 secs.

VC++ 6.0 MFC - Temp disable mouse and keyboard for 5 secs.

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rolfhorror
    wrote on last edited by
    #1

    I'm developing an app that needs to shut off the monitor after a given time, much like a screensaver. I've done some googling but cannot seem to find anything that works or is relevant. My example function: void CMyAppDlg::OnTimer(UINT nIDEvent) { //Turn off monitor / standby - (depends on monitor) //my lcd only goes to "sleep". SendMessage(WM_SYSCOMMAND, SC_MONITORPOWER, 2); //<- this works, but is aborted ad soon as user move mouse or keys... //Here is where I need to "freeze" mouse and keybrd. //for 5 sec. or so, to prevent user from activating / wake up the //monitor again aborting the shutoff-command, so they realize it's shut //off. CDialog::OnTimer(nIDEvent); } Thanx! (VC++ 6.0 MFC, Win-XP)

    R 1 Reply Last reply
    0
    • R rolfhorror

      I'm developing an app that needs to shut off the monitor after a given time, much like a screensaver. I've done some googling but cannot seem to find anything that works or is relevant. My example function: void CMyAppDlg::OnTimer(UINT nIDEvent) { //Turn off monitor / standby - (depends on monitor) //my lcd only goes to "sleep". SendMessage(WM_SYSCOMMAND, SC_MONITORPOWER, 2); //<- this works, but is aborted ad soon as user move mouse or keys... //Here is where I need to "freeze" mouse and keybrd. //for 5 sec. or so, to prevent user from activating / wake up the //monitor again aborting the shutoff-command, so they realize it's shut //off. CDialog::OnTimer(nIDEvent); } Thanx! (VC++ 6.0 MFC, Win-XP)

      R Offline
      R Offline
      Resmi Anna
      wrote on last edited by
      #2

      #include // For Visual Studio 6.0
      :
      BlockInput( true );
      Sleep( 5000 );
      BlockInput( false );

      Is this of any use for you??Please include the proper header

      R 1 Reply Last reply
      0
      • R Resmi Anna

        #include // For Visual Studio 6.0
        :
        BlockInput( true );
        Sleep( 5000 );
        BlockInput( false );

        Is this of any use for you??Please include the proper header

        R Offline
        R Offline
        rolfhorror
        wrote on last edited by
        #3

        Thanks BlockInput() was what I was looking for. :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups