Regarding applications running in the background.

G

Guest

Hi!

I have to write an application that runs in the background in the system
tray. It should listen to keyboard events and send messages to another
program that is currently active. Can anyone suggest me solution.

Thank you,
 
P

PiotrKolodziej

I have to write an application that runs in the background in the system

Use BackgroundWorker or create separate thread.
It should listen to keyboard events and send messages to another
program that is currently active. Can anyone suggest me solution.

You ony have to handle keydown event(s) and communicate with the program you
want.


PK
 
V

Vadym Stetsyak

Hello, Aravind!

A> I have to write an application that runs in the background in the
A> system tray. It should listen to keyboard events and send messages to
A> another program that is currently active. Can anyone suggest me
A> solution.

Listeting program establishes win32 keyboard hooks
( http://www.codeproject.com/csharp/NetWin32Hooks.asp )
( http://support.microsoft.com/kb/318804/ )

Also you have to choose the way of communication, at your disposal are the following ways:
- sockets
- named pipes
- remoting
- memory mapped files
- windows messages ( e.g. WM_COPYDATA )
etc.
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
G

Guest

Thank you for your reply. I have to write seperate application that listens
both keyboard n mouse events. It should send messages to another application
(active application) whenever some set of keys are pressed. Does Key hooks
solve my problem or do I need to use BackgroundWorker class??

Thanx

Aravind.
 
P

PiotrKolodziej

Why to use thread or backgroundWorker.

Answer. When you press button your application raises an event.
Then you are sending info to other application.
During the sending time, your applicatiion has a "lag".
When you create a seperate thread for sending data, you'r events might be
handled in the same time you are sending info to other program.

If i were you i'd use one thread for sending info, and handle events that i
need to be handled.
If you need info how to create thread you can shoot me emal if you want.

PK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top