By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,558 Members | 1,699 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,558 IT Pros & Developers. It's quick & easy.

Background Process and Keypress

P: n/a
I am wanting to write a program that will run in the background, but will
intercept a keypress (<CTRL> + <ALT> + L) and do a certain action.
Unfortunately, the only way that I've been able to accomplish this is if the
program is the active window. Is there a way to have this running as a
background process, yet still able to intercept keypresses?

Thanks.
Joshua
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
This is only possible with a global hook (SetWindowsHookEx), and is not
possible in either VB.Net or in C#.

But note that you would not want it to work, as the notion of injecting a
managed app into every process is a frightening one, to say the least.
--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Joshua Campbell" <Jo*************@WellmanInc-DieSpamDie.com> wrote in
message news:eK**************@TK2MSFTNGP11.phx.gbl...
I am wanting to write a program that will run in the background, but will
intercept a keypress (<CTRL> + <ALT> + L) and do a certain action.
Unfortunately, the only way that I've been able to accomplish this is if the program is the active window. Is there a way to have this running as a
background process, yet still able to intercept keypresses?

Thanks.
Joshua

Nov 20 '05 #2

P: n/a
True. Oh well. Thanks.

"Michael (michka) Kaplan [MS]" <mi*****@online.microsoft.com> wrote in
message news:uL*************@TK2MSFTNGP09.phx.gbl...
This is only possible with a global hook (SetWindowsHookEx), and is not
possible in either VB.Net or in C#.

But note that you would not want it to work, as the notion of injecting a
managed app into every process is a frightening one, to say the least.
--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Joshua Campbell" <Jo*************@WellmanInc-DieSpamDie.com> wrote in
message news:eK**************@TK2MSFTNGP11.phx.gbl...
I am wanting to write a program that will run in the background, but will intercept a keypress (<CTRL> + <ALT> + L) and do a certain action.
Unfortunately, the only way that I've been able to accomplish this is if

the
program is the active window. Is there a way to have this running as a
background process, yet still able to intercept keypresses?

Thanks.
Joshua


Nov 20 '05 #3

P: n/a
Hi Joshua,

Getting global access to the keyboard is easy when you follow the
footsteps of a Master.

The Master in question is Paul Kimmel, author of Visual Basic .NET
Unleashed, and he has written a three-part article explaining the whats and
hows of trapping the keyboard using SetWindowsHookEx:

http://www.developer.com/net/net/art...1087_2193301_1

Have fun. :-)

Regards,
Fergus
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.