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. capturing keydown events

capturing keydown events

Scheduled Pinned Locked Moved C#
csharpjsonhelptutorialquestion
2 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.
  • J Offline
    J Offline
    jtmtv18
    wrote on last edited by
    #1

    I havent done any programming in a few months now, and as such i kinda forgot alot of this stuff... i used to know the anwser to this question *i wrote a program using it before* but alas, i forgot. Anyways what i need is to have my program running in the background without focus and beable to detect when i press a combo of buttons on my computer, and have it regain focus agian. Its simple i know, but i just pretty much forgot how to do alot of programming, anyways thanks for your help guys. Do i have to catch api calls, if so can you kindly provide any of them or ways of finding them, im looking now for them but i think there has to be a easyier way, a managed .Net way. anyways thanks for your time. The Code Project Is Your Friend...

    H 1 Reply Last reply
    0
    • J jtmtv18

      I havent done any programming in a few months now, and as such i kinda forgot alot of this stuff... i used to know the anwser to this question *i wrote a program using it before* but alas, i forgot. Anyways what i need is to have my program running in the background without focus and beable to detect when i press a combo of buttons on my computer, and have it regain focus agian. Its simple i know, but i just pretty much forgot how to do alot of programming, anyways thanks for your help guys. Do i have to catch api calls, if so can you kindly provide any of them or ways of finding them, im looking now for them but i think there has to be a easyier way, a managed .Net way. anyways thanks for your time. The Code Project Is Your Friend...

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      There is currently no "managed .Net way" of doing this, no. You need to implement system hooks by P/Invoking the necessary APIs. In fact, much of the .NET Framework BCL - especially System.Windows.Forms.dll - encapsulates native functionality already. You can see this by examing the BCL assemblies in the IL Disassembler (ildasm.exe that ships with the SDK) or another disassembler/decompiler of your liking. Read Global System Hooks in .NET[^]. Be very careful, however. System hooks need to be fast since all messages from a particular class of messages are passed through the hook. Some people writing managed code often take for granted what's given to you for free without thinking (or knowing) about the code that provides such functionality. And always make sure that your code will not currupt the system message pump unnecessarily. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

      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