write a background windows process to monitor USB input

NJAL
NJAL used Ask the Experts™
on
Hi,
   What is the way to write a background windows applicaiton. By that i mean to run it continuously in background to monitor input from the USB port. Once the background routine gets the input it has to trigger an application.
Please tell me how to do this.

IS it possible to write background processes for windows in VB or VC++?

Please help me ASAP:)

Thanking You
NJal
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
The best way is for the application to run as a service.

You can code this using VC++ and possibly VB. The app runs as a console application and receives messages from the service control manager to start/stop/restart. There is a special API for this.

However you can use a tool call svrany.exe (from the Windows resource kit) to make any executable file a service. I have written batch scripts and perl scripts and had them running as services.

If using this method, first code your app and get it running then use srvany to install it as a service.

Commented:
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/wmimatic.asp

This handy little gadget will write WMI code for you which will interogate all the properties and methods of physical hardware on the pc.

You should be able to find code within this script which will create the monitoring process you require. Couple this with the idea from Gnuru and you should have what you are after.

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is to:

Accept gnuru's  comments as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
st_steve
EE Cleanup Volunteer
Per recommendation.

YensidMod
EE Moderator

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial