sharptooth
sharptooth

Reputation: 170499

How do I subvert computer idle detection on Windows?

In order to detect user absence GetLastInputInfo() can be used.

I want to make GetLastInputInfo() return that I've just used keyboard/mouse all the time - as I've been actively using the computer so that whoever relies on GetLastInputInfo() thinks I'm actively using the computer.

Can I use any Windows API functions to achieve that?

Upvotes: 2

Views: 486

Answers (3)

Dean Harding
Dean Harding

Reputation: 72658

What is this for? Do you just want to disable the screensaver? If that's the case, then you're probably better off looking at the SetThreadExecutionState function.

Upvotes: 2

Anders
Anders

Reputation: 101616

Have you tried to simply move the mouse up and down a bit (15 pixels or so) with SendInput()?. I can't remember if NT6+ only resets the timeout for real hardware input or not.

The other options are:

Upvotes: 2

SLaks
SLaks

Reputation: 887415

You're looking for the SendInput function.

Upvotes: 3

Related Questions