0

I've been trying to code program that shutdowns computer automatically in C#. User simply inserts hours and minutes and after that time computer will turn off. Everything is working, but I want to add 'status' message. I want it to show if shutdown proccess in computer is on or off. I don't really know how to do it.

Eron
  • 87
  • 1
  • 6
  • 1
    Did you know there's a `shutdown` command already? Check `shutdown /?` in cmd.exe – Blorgbeard Jun 04 '19 at 18:04
  • I know, I'm using that. The point is how to check in c# if shutdown proccess in computer is on. For example : I'm setting it on one hour, press OK and it says below something like "Status : Set", if i cancel it it says "Status: not Set" – Eron Jun 04 '19 at 18:19
  • Ok. Looking [here](https://stackoverflow.com/questions/6156216/detecting-a-scheduled-shutdown) it doesn't look easy/possible. You could just maintain your own state, and assume noone will schedule or abort shutdowns without using your program. – Blorgbeard Jun 04 '19 at 18:23
  • Use the [task scheduler](https://stackoverflow.com/q/7394806/327083). – J... Jun 04 '19 at 19:29

0 Answers0