How would I have a program wait for me to press "ctrl+shift+c" or something similar while in another program to execute?
Printable View
How would I have a program wait for me to press "ctrl+shift+c" or something similar while in another program to execute?
"How would I have a program wait for me to press (x) while in another program to execute"...
Possible interpretations:
1) You want a program to execute when you press a button in another program
2) You want your program to suspend itself until a keypress in another application
3) Some other obscure interpretation
You seriously have to word your question better. It's sort of unintelligible at the moment.
One other possible interpretation:
He wants to make a hotkey to launch his program from anywhere within windows.
> You seriously have to word your question better. It's sort of unintelligible at the moment.
Agreed. :)
That's what I want, sorry for not being more specific.Quote:
Originally Posted by Codulation
Well, I'm not totally sure where hotkey messages are captured from (does the hotkey have to be pressed in the window of the program?), but you could look into RegisterHotKey(). Write a program that calls that at startup, and handles the WM_HOTKEY message by launching your target application (look into CreateProcess(), or less preferably system()). You'll need to know a small amount of Windows API code to do so though.
>does the hotkey have to be pressed in the window of the program
A hotkey is handled at the Windows level and has nothing to do with your program. It's only a way to tell Win. to launch your program.
BTW, in Win XP in the properties of a shortcut, you can set a hotkey to launch it.