Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to detect key strokes in c# when my application is not active?

Posted on 2009-05-08
4
Medium Priority
?
916 Views
Last Modified: 2013-12-17

I'm working on a custom clipboard manager. I pretty much want an app that replaces the windows clipboard with one that can store multiple instances of text, images, and/or files. The general idea is this will be a windows C# application (probably written with Visual C# 2008 Express Edition) where it will namely reside in the system tray and have no active window. I want to be able to use a specific key combination to pull up the active window for this application I'm creating. I don't want to bother with moving the mouse around or all that.

I guess it boils down to needing to be able to check all keystrokes against the specific combination setup for my application regardless what window is acting.

I've found some articles that discuss this in a broad manner but I'm really trying to get some code for this. Any help you can provide would be greatly appreciated. Thanks!
0
Comment
Question by:baijajusav
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Assisted Solution

by:mac-will
mac-will earned 1600 total points
ID: 24338830
0
 
LVL 3

Author Comment

by:baijajusav
ID: 24338901

That's probably exactly what I need. I'll test over the weekend to verify.
0
 
LVL 3

Accepted Solution

by:
baijajusav earned 0 total points
ID: 24339187
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 400 total points
ID: 24339252
Right...you basically only have three options:  (all involving external WinAPIs)
(1) Trap ALL keystrokes with a low level keyboard via WH_KEYBOARD_LL.
(2) POLL the keyboard with a Timer and the GetAsyncKeyState() API.
(3) Register your desired key combo as a system wide hotkey via RegisterHotkey().  This is the least resource intensive BUT only one process can register a unique key combo.  If another app has already taken your combo then you have no recourse but to pick another one or use methods #1 or #2 instead.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question