Search code examples
c#windowswinformsscreensaver

Alternative Input Device(Midi) doesn't prevent Screen Saver in Winforms application


I have developed a C# WinForms application whereby the user is providing input via a MIDI-connected device. The user will go for long periods without using the keyboard or mouse.

When I receive a MIDI message, is there anything I can do to "tell" the system that this counts as user activity (i.e., key press). I don't want the screen saver or time lockouts to occur if the MIDI device is actively being used.

I think my request is different than other requests I've seen because they want to disable screen savers for the life of their application whereby I just want MIDI input I receive to count as user interactivity.

Is there something I can call when I receive MIDI input to signify to the system user activity?


Solution

  • Here's a CodeProject project that appears to do this:

    http://www.codeproject.com/KB/cs/ScreenSaverControl.aspx

    Looks like you can just call his SetScreenSaverTimeout(GetScreenSaverTimeout()) method every time you receive MIDI input.