Question :
I need to detect if the user is scrolling the mouse scroll down.
I tried with GetKeyState
, but it seems that there is no way to scroll the mouse scroll.
I also found this , but not I could understand how to use it in C #.
Code:
if (/* Aqui eu devo checar se o usuário está rolando o scroll */)
{
Stopwatch s = new Stopwatch();
s.Start();
while (s.Elapsed < TimeSpan.FromMilliseconds(300))
{
//Irrelevante
}
s.Stop();
}
I also found this , but I have no idea how to use it in a console application.
Answer :
There are a few ways.
MOUSE_WHEELED
if the mouse whell is rotated ex from windows.Form without the form, just the console.
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new WindowlessApplicationContext());
}
}
internal class WindowlessApplicationContext : ApplicationContext
{
public WindowlessApplicationContext()
{
try
{
//Your code
}
// you mayy add catch here
finally
{
//Close process
Environment.Exit(0);
}
}
}
More information: