|
It changes the power options to make the PC go to hibernate one minute after the user logs off.
If you copy and paste this part of the code into a dos window you will see the change in Windows power options
POWERCFG /CHANGE /hibernate-timeout-dc 1
It works OK when I install the app and then log off. But if I log
back on and log off after that it gives me "the application was unable
to start" error and an error code.
I can only log off once for it to work. Restarting doesn't fix it.
Would appreciate any help, thanks.
Sam HobbsPosted Jan 19, 2011, 3:27 PM
If you need to write a program that works when the user is logged off then you might not be able to use C#. Are you sure that applications can execute without a user being logged on? If not then perhaps you need to write a Windows Service (not a web service).
Peter MalonePosted Jan 19, 2011, 9:04 AM
Suthish NairPosted Jan 19, 2011, 6:28 AM
Lock, Logoff, Reboot, Shutdown, Hibernate, Standby in .Net
Peter MalonePosted Jan 19, 2011, 3:44 AM
Edit:
I have since changed the code to the following:
It does the same thing;it works when the app is first installed and I log off but gives the error below everytime I log off after that."The application was unable to start correctly (0xc0000142). Click OK to close the application."
Sam HobbsPosted Jan 18, 2011, 10:02 PM