Results 1 to 5 of 5

Thread: Enable/disable win key

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    2

    Enable/disable win key

    I want to develop a cyber cafe management software in Visual Basic 6. so i need to disable/enable the WIN key(middle key of Ctrl and Alt). please help me.

    I can disable/enable the remain keys. Waiting for good comments.


    Thanks in advance.

  2. #2
    New Member
    Join Date
    Nov 2007
    Posts
    5

    Re: Enable/disable win key

    Well, im just starting out on any kind of VB, but having experience in Liberty BASIC, you probably have to find the virtual key code for the Win key. Try doing a Google search for it.

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Enable/disable win key

    Handle the keyup event.
    Put a breakpoint in the event and start your application (you must have keypreview set to true on the form properties). Now press the winkey.
    Your breakpoint will hit. Check the value of "e" (KeyEventArgs).
    Now you can create something like.
    If e.keyvalue (or e.keycode) = (The value of the win key)
    do nothing
    else
    do something

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Enable/disable win key

    Just saw you are using vb6.
    The example is for .net.

  5. #5
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Enable/disable win key

    there are a couple of recent threads on this for use in vb6. This gets asked all the time because the windows key will case some games to crash to desktop if you hit it while playing accidently (easy if the ctrl is the fire button).

    Either search the forums for "Block ctrl-esc" or something like that (because that's what the windows key really is) or study up on making a keyboard hook. Your app needs to hook the keyboard so all keypresses are filtered through it. Then it returns back to the OS ones it allows. Basically your sub would get called with each keypress.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

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