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. Get keys

Get keys

Scheduled Pinned Locked Moved C#
csharphtml
4 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.
  • D Offline
    D Offline
    drc_no1
    wrote on last edited by
    #1

    Hello! I'm trying to do a program that logs all the key presses of the keyboard. The application runs smooth (VisibleInTaskBar = false, Visible = false), but, by doing that, i lose the focus on my form. So, i would be interested if there is a way to "intercept" the key strokes from code. I've searched www.pinvoke.net -> and found this: GetKeyState, but, unfortunately, i wasn't able to implement this. I've also searched the articles, still... nothing relevant to this ... GetKeyState method or ways to implement it. Thanks a lot, Catalin David.

    J S 2 Replies Last reply
    0
    • D drc_no1

      Hello! I'm trying to do a program that logs all the key presses of the keyboard. The application runs smooth (VisibleInTaskBar = false, Visible = false), but, by doing that, i lose the focus on my form. So, i would be interested if there is a way to "intercept" the key strokes from code. I've searched www.pinvoke.net -> and found this: GetKeyState, but, unfortunately, i wasn't able to implement this. I've also searched the articles, still... nothing relevant to this ... GetKeyState method or ways to implement it. Thanks a lot, Catalin David.

      J Offline
      J Offline
      jack_claudine
      wrote on last edited by
      #2

      why not create a windows service project? I think this should do the trick.

      1 Reply Last reply
      0
      • D drc_no1

        Hello! I'm trying to do a program that logs all the key presses of the keyboard. The application runs smooth (VisibleInTaskBar = false, Visible = false), but, by doing that, i lose the focus on my form. So, i would be interested if there is a way to "intercept" the key strokes from code. I've searched www.pinvoke.net -> and found this: GetKeyState, but, unfortunately, i wasn't able to implement this. I've also searched the articles, still... nothing relevant to this ... GetKeyState method or ways to implement it. Thanks a lot, Catalin David.

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        drc_no1 wrote:

        I'm trying to do a program that logs all the key presses of the keyboard.

        What key presses do you want to log; only those of your application or system-wide?


        "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

        www.troschuetz.de

        D 1 Reply Last reply
        0
        • S Stefan Troschuetz

          drc_no1 wrote:

          I'm trying to do a program that logs all the key presses of the keyboard.

          What key presses do you want to log; only those of your application or system-wide?


          "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

          www.troschuetz.de

          D Offline
          D Offline
          drc_no1
          wrote on last edited by
          #4

          System-wide, that's the problem. Because on the application would be quite easy. But i don't know how to implement it system-wide. Thanks a lot!

          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