Thanks for sharing this. I have tested it and by reading your source i see that you do not trigger system, just override a powerstate.
This action kinda confuse my Windows own powersetting. (if system goes sleep mode ScreenSaver -> ScreenOff, then automatic start background jobs, those wont executed anymore with your method)
I look on my own how to deal with WinApi correct to do what you done.
For myself i just done some overrides that do exact the different way, let system always be on :-)
(i needed such feature for my MediaPlayer project, when no mousemovement = screen goes blank = monitor speaker goes off)