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. C# replacement for GetAsyncKeyState?

C# replacement for GetAsyncKeyState?

Scheduled Pinned Locked Moved C#
csharpquestion
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.
  • Z Offline
    Z Offline
    Zombies with Coffee LLC
    wrote on last edited by
    #1

    I used to see if the control key was being held down while scrolling the mouse wheel with GetAsyncKeyState( VK_CONTROL ) What is the preferred way of determining if a keystroke is currently pressed in C#/.NET? Thanks a million!

    Z E 2 Replies Last reply
    0
    • Z Zombies with Coffee LLC

      I used to see if the control key was being held down while scrolling the mouse wheel with GetAsyncKeyState( VK_CONTROL ) What is the preferred way of determining if a keystroke is currently pressed in C#/.NET? Thanks a million!

      Z Offline
      Z Offline
      Zombies with Coffee LLC
      wrote on last edited by
      #2

      Found something close already... Tis funny, you rack your brain for 2 hours, post something, then find it 5 minutes later and feel like a dope. if(( Control.ModifierKeys & Keys.Control ) == Keys.Control )

      1 Reply Last reply
      0
      • Z Zombies with Coffee LLC

        I used to see if the control key was being held down while scrolling the mouse wheel with GetAsyncKeyState( VK_CONTROL ) What is the preferred way of determining if a keystroke is currently pressed in C#/.NET? Thanks a million!

        E Offline
        E Offline
        ez2
        wrote on last edited by
        #3

        From the docs, try this if ((Control.ModifierKeys & Keys.Control) == Keys.Control) MessageBox.Show("Control key pressed");

        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