Code Monkey home page Code Monkey logo

Comments (1)

gdegeneve avatar gdegeneve commented on August 24, 2024

Interesting, but does the underlying function of resetting the timers work? Is the display prevented from turning off when you call the methods periodicly?

I mean setting those two flag with continous is optional, you can just set system required and display required without continous and the timers will reset for the thread all the same. the only difference with continous is that the timers will reset automatically for the calling thread for as long as the thread lives or the two flags are removed. So even though your display required does not stick it should (if there is a display attached) reset the timers for it.

But for a more likely scenario my guess would be that even though you have an interactive session there is no display with a timer bound to that session. Windows at its core has terminal server functionality with multiple parallel sessions but one display is only connected to one session at a time. and thats not the interactive session for the local system user, thats maybe the reason the continous display required flag does not stick since there is no display attached.

have you by chance called GetLastWin32Error from the marshal class? And converted the number you get (hopefully > 0) to a error message using FormatMessage from kernel32.dll? What does it say. I mean it should say something if the executionstate could not be fully set to the desired value.

sanity check ... you are operating on one thread. not with some async await stuff on the thread pool. the setthreadexecutionstate has thread in it so its a per thread setting and threads in the threadpool are kind of short lived sometimes. console apps have traditionally one thread that is bound to the terminal, a gui app has one main thread with its application loop, a windows service with the newest service host builders and backgroundservices lives on the threadpool.

from awake.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.