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. How to get key board entries on windows explorer ?

How to get key board entries on windows explorer ?

Scheduled Pinned Locked Moved C#
csharphtmlcomalgorithmstools
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.
  • S Offline
    S Offline
    srikrishnathanthri
    wrote on last edited by
    #1

    Hello, I have a requirement of triggering my application on Ctrl+d only when user is in Windows Explorer. For that I have an ahk script which works perfectly..

    #IfWinActive ahk_class CabinetWClass
    ^d::
    Run "C:\myapp.exe"
    return
    #IfWinActive ; turn off context sensitivity

    But I want implement the same in C#, While searching I came to know that this can be done using Autohotkey.dll from this site But no where I got any working dll. How to achieve in my requirement in c# ? I got a project which gets the keyboard entries when it is in foreground but how to catch the keyboard entries of other window (In my case Windows Explorer) while my app is running in background? Please help.

    D 1 Reply Last reply
    0
    • S srikrishnathanthri

      Hello, I have a requirement of triggering my application on Ctrl+d only when user is in Windows Explorer. For that I have an ahk script which works perfectly..

      #IfWinActive ahk_class CabinetWClass
      ^d::
      Run "C:\myapp.exe"
      return
      #IfWinActive ; turn off context sensitivity

      But I want implement the same in C#, While searching I came to know that this can be done using Autohotkey.dll from this site But no where I got any working dll. How to achieve in my requirement in c# ? I got a project which gets the keyboard entries when it is in foreground but how to catch the keyboard entries of other window (In my case Windows Explorer) while my app is running in background? Please help.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You can see an answer on how to use RegisterHotKey here[^]. Inside the handler you would have to get the currently active window handle using GetForegroundWindow function (Windows)[^]. You then pass that handle to the GetWindowThreadProcessId function (Windows)[^] to get the Process ID (PID) of the window. Compare that to the list of Process ID's you can get from the Process class and make sure the process name is "Explorer.exe". If there's a match, do whatever you need to do.

      A guide to posting questions on CodeProject

      Click this: Asking questions is a skill. Seriously, do it.
      Dave Kreskowiak

      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