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. Check windows workstation is locked or not

Check windows workstation is locked or not

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 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.
  • M Offline
    M Offline
    masaniparesh
    wrote on last edited by
    #1

    Hi Friends, I have written below code for checking whether windows machine is locked or not but its gives always window is locked though its not locked. Could anyone suggest what is wrong here or can give alternative solution? bool lockedHost = false; HMODULE hUser32; FARPROC LockWorkStation; hUser32 = GetModuleHandle("user32.dll"); if (hUser32) { LockWorkStation = GetProcAddress(hUser32, "LockWorkStation"); if (LockWorkStation) { lockedHost = true; MessageBox(0, "locked1", "Info", MB_OK); } } Thanks in advanced, Paresh

    F J 2 Replies Last reply
    0
    • M masaniparesh

      Hi Friends, I have written below code for checking whether windows machine is locked or not but its gives always window is locked though its not locked. Could anyone suggest what is wrong here or can give alternative solution? bool lockedHost = false; HMODULE hUser32; FARPROC LockWorkStation; hUser32 = GetModuleHandle("user32.dll"); if (hUser32) { LockWorkStation = GetProcAddress(hUser32, "LockWorkStation"); if (LockWorkStation) { lockedHost = true; MessageBox(0, "locked1", "Info", MB_OK); } } Thanks in advanced, Paresh

      F Offline
      F Offline
      fantasy1215
      wrote on last edited by
      #2

      Though I don't know how to check whether the workstation is locked or not. But I do know what wrong with your code! 1、LockWorkStation = GetProcAddress(hUser32, "LockWorkStation"); Only return the function pointer of "LockWorkStation".Then you can use this function! 2、LockWorkStation is the function to lock workstation, not to check whether the workstation is locked or not. Do check MSDN! Gurus may answer your question!

      1 Reply Last reply
      0
      • M masaniparesh

        Hi Friends, I have written below code for checking whether windows machine is locked or not but its gives always window is locked though its not locked. Could anyone suggest what is wrong here or can give alternative solution? bool lockedHost = false; HMODULE hUser32; FARPROC LockWorkStation; hUser32 = GetModuleHandle("user32.dll"); if (hUser32) { LockWorkStation = GetProcAddress(hUser32, "LockWorkStation"); if (LockWorkStation) { lockedHost = true; MessageBox(0, "locked1", "Info", MB_OK); } } Thanks in advanced, Paresh

        J Offline
        J Offline
        Jijo Raj
        wrote on last edited by
        #3

        Check out this link - http://stackoverflow.com/questions/44980/how-can-i-programmatically-determine-if-my-workstation-is-locked[^]. Regards, Jijo.

        _____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

        modified on Sunday, November 23, 2008 7:15 AM

        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