A quick background on the project... I'm running a web app that allows users to control and read data from devices connected to the server machine (in my case, an Intel NUC).
My issue is that I'm trying to detect global mouse events inside of a System.Windows.Form that's run in a background thread.
private static Thread serviceThread;
private IKeyboardMouseEvents mouseEvents;
private int currentPixel = 0;
private List<byte> rgb = new List<byte> { 255, 0, 0 };
public static void StartService()
{
serviceThread?.Abort();
serviceThread = new Thread(() =>
{
Application.Run(new TiltWheelService());
});
serviceThread.Start();
}
public TiltWheelService()
{
mouseEvents = Hook.GlobalEvents();
mouseEvents.MouseDown += OnMouseDown;
mouseEvents.MouseWheel += OnMouseScrollWheel;
}
Now, when I run the app via IIS Express through Visual Studio 2017 (in either Debug or Release), it launches my App, brings up an instance of Chrome, and creates a windows form successfully, and I'm able to listen to any mouse event (in this case mouse down and scroll) and do what I want with it.
When I publish this to my locally running IIS Manager, however, the Windows Form never shows up and I'm unable to listen to mouse events.
Any suggestions would be helpful!