Prevent computer from starting screensaver

I'm doing some changes to a video player application which disables the windows screen saver while playing video. I have some code which prevents the screensaver from activating. But when the video stops and my code stops preventing the screen saver from activating, the screen saver immediately kicks in.

I'm basically capturing the WM_SYSCOMMAND  SC_SCREENSAVE  event and returning 0 while video plays. Which successfully blocks the screen saver. But when the video stops and I stop capturing this event, the screen saver immediately kicks in.

So is there any way I can reset the screen saver timer?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

One clue is in the dox for the SystemParametersInfo() API.  
   SystemParametersInfo Function


    Retrieves a BOOL indicating whether an application can reset the
    screensaver's timer by calling the SendInput function to simulate
    keyboard or mouse input.

I don't know what the default/normal value is, but if it is normally FALSE, then that would lead me to believe that you could reset the screensaver's timer by using the SendInput API.
    SendInput Function

My first try would be to send a simulated small mouse movement.  Then I'd try sending a keystroke.

-- Dan

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OdieGibletAuthor Commented:
Thanks, I got it working with SendInput!
Note from OdieGiblet (for future Solutions database searchers):
   Thanks, I got it working with SendInput!

You're welcome.  Glad I could help!
-- Dan
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.