CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2000
    Location
    Québec, Canada
    Posts
    1

    Locking Keyboard and Mouse

    Hi,

    I need to lock the keyboard and the mouse in one of my application in VB5. And I need to unlock it after the end of a particular process.

    Thank you




    Luc Champoux

  2. #2
    Join Date
    Feb 2000
    Location
    America
    Posts
    130

    Re: Locking Keyboard and Mouse

    lol...."particular process".........this "particular process" wouldn't be a freak-out program designed to scare the victum, would it? lol....go find a hacker forum, this is for good clean programming


  3. #3
    Join Date
    Mar 2000
    Location
    Seal Beach, CA USA
    Posts
    1

    Re: Locking Keyboard and Mouse

    I haven't found a "lock computer" yet but here is a little ditty that will cause the screen saver to be started which will lock the screen if you have that turned on.





    Try the following :
    open vb
    start new standard project
    delete form1
    open new module
    Past the following :

    Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long


    Sub Main()
    Dim result As Long
    Const WM_SYSCOMMAND As Long = &H112&
    Const SC_SCREENSAVE As Long = &HF140&
    result = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0&)
    End
    End Sub


    Now go up and create a new form1 (won't be called now but it's handle is needed)


    run the code. It should go stright to the screen saver which locks my keyboard and mouse after a couple of seconds......


    hope this helps

    Andy


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured