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. background program to capture a key press

background program to capture a key press

Scheduled Pinned Locked Moved C#
question
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.
  • M Offline
    M Offline
    mikemilano
    wrote on last edited by
    #1

    i have a windows application that currently takes screen shots and copies the image to a directory. the program takes a screen shot of either the active window, or the whole screen based on the keystroke. well obviously the 'active window' screen shot will always take a screen shot of itself, so i want to convert this so it runs in the background somehow. i hope i'm making sense. basically i want to be able to press a couple buttons and no matter what program i'm in, have the computer take a screen shot. do i need to make a windows service? any insight would be greatly appreciated.

    H 1 Reply Last reply
    0
    • M mikemilano

      i have a windows application that currently takes screen shots and copies the image to a directory. the program takes a screen shot of either the active window, or the whole screen based on the keystroke. well obviously the 'active window' screen shot will always take a screen shot of itself, so i want to convert this so it runs in the background somehow. i hope i'm making sense. basically i want to be able to press a couple buttons and no matter what program i'm in, have the computer take a screen shot. do i need to make a windows service? any insight would be greatly appreciated.

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

      You'll need to install a windows keyboard hook since there would be no active window to process the keyboard notification messages. There's been several good articles about this here on CodeProject, including Using Hooks from C#[^]. See http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/hooks.asp[^] for more information.

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      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