0

I am about to start working on an application that runs in the background waiting for a certain user input somewhat like apple's spotlight.

Basically the user will give the service a certain key combination that will bring it up (i.e. CTRL + Space or CTRL + p) and the application main GUI will be brought up.

Now my questions:

  • First, I want this application to have a very small footprint and not draw on many system resources, and not interfere with the operation of other applications.

    I also would like to write this application in C#. So far the best idea I have had would be to write a service that listened for key strokes and threw away stroke that were not either the control or following a control key.

    This does not seem optimal is there a better way, anyone know how spotlight works?

  • Second, I am concerned that this kind of service might be identified as mall ware.

    What steps might I take to ensure that my software is not targeted by applications such as Avast and Spysweeper?

    Would I need to contact all of the manufacturers of these software packages and explain the purpose of my application?

  • Finally, if anyone could link to resources about how to set up such a service I would greatly appreciate it.

helmbert
  • 35,797
  • 13
  • 82
  • 95
Mike2012
  • 7,629
  • 15
  • 84
  • 135

2 Answers2

2

Services are not supposed to interact with the desktop user, as such they aren't supposed to be able to hook and watch for keystrokes. This may work on XP but you will likely have many problems on Vista/7 and later OS's.

You really need a userspace program that runs at user startup to do this that runs as the same user as the logged in user.

Also, if you are concerned about minimal footprint and resource usage, you don't want to be using .NET because it needs to load a fairly large runtime library and creates a fairly big working set. Usually this isn't a problem, but for something like a watcher program, it's best to write it in low footprint C using a low footbring minimal CRT startup.

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
0

My suggestion would be to create a winforms application, add the system tray icon using NotificationIcon to the main form of the application. Then hide the main form. The application can receive key strokes, particularly if you set the FormsPreview property to true. You might also need to hook into the windows api keypress events.

You should be safe from Malware scanners.

You may want to take a look at this link for setting up a system tray/win forms app.

How can I make a .NET Windows Forms application that only runs in the System Tray?

Community
  • 1
  • 1
Rick Hodder
  • 2,189
  • 3
  • 26
  • 54