you may read this topic:
Mouse Wheel Event (C#)
If you have own controls, you can setup such things very easily throught the designer, or in code dynamically. However, the mouse needs to be on top of your control, so that you will receive the event. So in your case you need to register on the message filter. Take care, that you do not do to much in there. This may slow down your whole application, if you do to much at this place:
public bool PreFilterMessage(ref Message m)
You can also setup a windows forms project without showing a form either. Here is a program.cs code of a windows forms project:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new WindowlessApplicationContext());
}
}
/// <summary>
/// The window less application context.
/// </summary>
internal class WindowlessApplicationContext : ApplicationContext
{
/// <summary>
/// Standard constructor.
/// </summary>
public WindowlessApplicationContext()
{
try
{
//Your code
}
// you mayy add catch here
finally
{
//Close process
Environment.Exit(0);
}
}
}