Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,676 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,200 people online right now. Registration is fast and FREE... Join Now!




Making a program run on a certain keypress in Windows

 
Reply to this topicStart new topic

Making a program run on a certain keypress in Windows

ericode
post 17 Jul, 2007 - 09:41 PM
Post #1


D.I.C Head

Group Icon
Joined: 9 Dec, 2006
Posts: 89



Dream Kudos: 75
My Contributions


Hello all, here is an interesting question: How would I make it so that a certain key press (or sequence of keys) triggers a program to run. I want to get behavior similar to Google Desktop which can pop up a search bar whenever the user presses Ctrl twice in rapid succession (no matter what other window is open at the time). I am primarily interested in doing this in Windows, but would not object if anyone has a way to do this in Linux as well.

I think this would be done by making a daemon to run in the background and monitor keys being pressed. The trick is, how can a program listen to what keys are being pressed if it is not the window currently selected?
User is offlineProfile CardPM

Go to the top of the page

dogboi
post 17 Jul, 2007 - 09:55 PM
Post #2


D.I.C Head

Group Icon
Joined: 10 Jul, 2007
Posts: 93



Dream Kudos: 25
My Contributions


A quick search on google resulted in an answer.

This will work in windows anyhow.
User is offlineProfile CardPM

Go to the top of the page

ericode
post 18 Jul, 2007 - 05:29 AM
Post #3


D.I.C Head

Group Icon
Joined: 9 Dec, 2006
Posts: 89



Dream Kudos: 75
My Contributions


Thanks for the link, that was exactly what I was searching for. Google wasn't as fruitful for me when I didn't know about the term "hotkey".



QUOTE(dogboi @ 17 Jul, 2007 - 10:55 PM) *

A quick search on google resulted in an answer.

This will work in windows anyhow.

User is offlineProfile CardPM

Go to the top of the page

dogboi
post 18 Jul, 2007 - 07:20 AM
Post #4


D.I.C Head

Group Icon
Joined: 10 Jul, 2007
Posts: 93



Dream Kudos: 25
My Contributions


QUOTE(ericode @ 18 Jul, 2007 - 09:29 AM) *

Thanks for the link, that was exactly what I was searching for. Google wasn't as fruitful for me when I didn't know about the term "hotkey".


No problem. It can be hard to find something without the appropriate search terms. lol. When you have the right ones, things pop up right at the top of the list. Otherwise, you could be searching for hours.

Glad I could help.


User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/23/08 06:30AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month