473,323 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Background Process and Keypress

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
3 7800
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Joshua Beall | last post by:
Hi All, I am working on a mailing list program for a client, and I am wondering what tbe hest way to deal with script timeouts is. I realize that I could use set_time_limit() to increase the...
1
by: Mathias Dahl | last post by:
I am creating a small app called PyQe (http://klibb.com/cgi-bin/wiki.pl/PyQe) to launch commands and programs quickly. I works more or less as I want it now and I have managed to make my window...
0
by: Mathias Dahl | last post by:
I have created a Python program that is running on my desktop. How can I make it listen for a certain keypress (say, Windows-key + space) in a controlled fashion even when it is not the program...
4
by: Mathias Dahl | last post by:
I have created a small Python program that is running on my desktop. How can I make it listen for a certain keypress (say, Windows-key + space) in a controlled fashion even when it is not the...
0
by: news.gorge.net | last post by:
I want to fire an event when a user presses Control+C when NOT in a situation where that keypress combo would copy something to the clipboard. My current attempt was to override the...
2
by: Paul Hatcher | last post by:
I have an ASP.NET application that uses a background threads to perform a long-running process. What I'm not sure is how to track and communicate with the thread. The site is divided up into...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
3
by: Fia | last post by:
Hi In Visual Basic 6 I could call keypress with an integer of a choosen key. For example I could call a textbox's keypress with the number 13 (for the enter key). But now in Visual Basic .Net I...
1
by: hsmcdonald | last post by:
Hello all, I have a mail function that sends parsed information to an employee distribution list. I was trying to setup a process where the admin can initiate a letter to this list, and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.