I first create a System.Threading.Timer from a private static, like this:
private static IntPtr SetHook(LowLevelKeyboardProc proc)
{
// EL MAIN AHORA ES ESTE
// declaracion de timer:
TimerCallback callback = new TimerCallback(Tick);
System.Threading.Timer stateTimer = new System.Threading.Timer(callback, null, 0, 10000);
}
And the timer as a static public void:
static public void Tick(Object stateInfo)
{
......
}
The problem is that the timer for a while runs correctly, but after a long period of time the time suddenly finish. How can I make it run indefinitely?
I read that I may have to add a "reference" but I have no idea how that is done.
Thanks you!