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#
  4. How to implement a screenlock

How to implement a screenlock

Scheduled Pinned Locked Moved C#
helptutorialquestion
6 Posts 4 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.
  • J Offline
    J Offline
    jamesjk
    wrote on last edited by
    #1

    Hi Buddies, Could somebody help me in implementing a screenlock? What I'm trin' to do is, if the user is not interacting with the system for a stipulated time I need to lock the screen, thereby forcing the user to enter his password to unlock the system. Thanks to all in Advance

    M M 2 Replies Last reply
    0
    • J jamesjk

      Hi Buddies, Could somebody help me in implementing a screenlock? What I'm trin' to do is, if the user is not interacting with the system for a stipulated time I need to lock the screen, thereby forcing the user to enter his password to unlock the system. Thanks to all in Advance

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello, Fast solution: create a full screen TopMost window with passwordbox. All the best, Martin

      T 1 Reply Last reply
      0
      • M Martin 0

        Hello, Fast solution: create a full screen TopMost window with passwordbox. All the best, Martin

        T Offline
        T Offline
        Tamimi Code
        wrote on last edited by
        #3

        funny :laugh::laugh:

        When you get mad...THINK twice that the only advice Tamimi - Code

        J 1 Reply Last reply
        0
        • T Tamimi Code

          funny :laugh::laugh:

          When you get mad...THINK twice that the only advice Tamimi - Code

          J Offline
          J Offline
          jamesjk
          wrote on last edited by
          #4

          HI GUYS, FIRST OF ALL THANKS FOR THE REPLY..... ISN'T IT POSSIBLE TO CALL SOME WINDOWS API THAT CAN DO THIS JOB FOR ME? BUT I DONT HAVE ANY IDEA OF WHICH API OR HOW? OR JUST PUT IT THE OTHER WAY... HOW DOES Windows SCREENLOCK WORK? ANY IDEA?

          1 Reply Last reply
          0
          • J jamesjk

            Hi Buddies, Could somebody help me in implementing a screenlock? What I'm trin' to do is, if the user is not interacting with the system for a stipulated time I need to lock the screen, thereby forcing the user to enter his password to unlock the system. Thanks to all in Advance

            M Offline
            M Offline
            mav northwind
            wrote on last edited by
            #5

            Hi! The corresponding Win32 function is called LockWorkStation and located in user32.dll. You can simply use this code:

            using System.Runtime.InteropServices;
            public class ScreenLock
            {
            [DllImport("user32.dll")]
            public static extern bool LockWorkStation();
            }

            Regards, mav -- Black holes are the places where God divided by 0...

            J 1 Reply Last reply
            0
            • M mav northwind

              Hi! The corresponding Win32 function is called LockWorkStation and located in user32.dll. You can simply use this code:

              using System.Runtime.InteropServices;
              public class ScreenLock
              {
              [DllImport("user32.dll")]
              public static extern bool LockWorkStation();
              }

              Regards, mav -- Black holes are the places where God divided by 0...

              J Offline
              J Offline
              jamesjk
              wrote on last edited by
              #6

              thanks mav. But how do I know the system idle time? Does the API does it by itself(I hope no).....? If I use Application.Idle definitely its not gonna to work. Is there anything like System.Idle :D ? thanks once again for the help & still look forward to you suggestions...

              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