Tray process question

D

DBC User

I have written a tray program and I want the program to perform some
scheduled job like copying files etc., My question is, if the user
leave the computer on but the program in hibernated mode, will the
program will run?
Lets say, my tray program checks the timer and if it is 8:00PM, then
it should copy bunch of files from one directory to another directory.
My question is if the PC is running in screen saver mode or in
hibernation will it still run?

Thanks.
 
P

Peter Duniho

[...]
Lets say, my tray program checks the timer and if it is 8:00PM, then
it should copy bunch of files from one directory to another directory.
My question is if the PC is running in screen saver mode or in
hibernation will it still run?

Screen saver and hibernation are very different. A screen saver doesn't
stop existing processes on the computer from executing. But hibernation
(and sleep/suspend as well) does. In fact, unlike with sleep/suspend
mode, when the computer is in hibernate mode it is actually turned off.

So no, your program won't have the ability to execute at a specific time
if the computer has hibernated.

Most computers do have a BIOS setting that allows the computer to turn on
at a specific time if it's not already on. You will probably need to
combine that configuration with whatever your program does to allow it to
actually run when you want it to, if the computer might be turned off or
suspended when the process is supposed to execute.

Pete
 
D

DBC User

[...]
Lets say, my tray program checks the timer and if it is 8:00PM, then
it should copy bunch of files from one directory to another directory.
My question is if the PC is running in screen saver mode or in
hibernation will it still run?

Screen saver and hibernation are very different. A screen saver doesn't
stop existing processes on the computer from executing. But hibernation
(and sleep/suspend as well) does. In fact, unlike with sleep/suspend
mode, when the computer is in hibernate mode it is actually turned off.

So no, your program won't have the ability to execute at a specific time
if the computer has hibernated.

Most computers do have a BIOS setting that allows the computer to turn on
at a specific time if it's not already on. You will probably need to
combine that configuration with whatever your program does to allow it to
actually run when you want it to, if the computer might be turned off or
suspended when the process is supposed to execute.

Pete

Hi Pete,

Thank you for the good information. Well, in that case, I can put a
limitation on the implementation that the program will not work on the
hibernation mode. Out of curiosity, Do you know if it is possible to
set the BIOS setting from c#, also turn the system back to hibernate
mode after the completion?

Thanks.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Lets say, my tray program checks the timer and if it is 8:00PM, then
it should copy bunch of files from one directory to another directory.
My question is if the PC is running in screen saver mode or in
hibernation will it still run?

There is a differnce between hibernation and seeing the screen saver, in the
latter the computer is running normally, its just no refreshing the screen.
In hibernation you save the status of the machine for it to be restored at a
later date. But it's not executing nothing.

So the answer is Yes to screensaver, No to hibernation
 
P

Peter Duniho

Thank you for the good information. Well, in that case, I can put a
limitation on the implementation that the program will not work on the
hibernation mode. Out of curiosity, Do you know if it is possible to
set the BIOS setting from c#, also turn the system back to hibernate
mode after the completion?

No, I don't know. I'm sure it depends on the BIOS itself, and from C# I'm
also sure you'd have to use some sort of p/invoke mechanism even if it
were theoretically possible.

As far as putting the computer back into hibernation mode, I'm guessing
*that* is possible but I don't know off the top of my head how to do it.
If I were you, I would look in the documentation around the same sections
that deal with shutting down the computer. There's probably some class or
API dedicated to power management (which the hibernation would be a part
of).

Pete
 
J

Jiri Sitina

No, I don't know. I'm sure it depends on the BIOS itself, and from C# I'm
also sure you'd have to use some sort of p/invoke mechanism even if it
were theoretically possible.

As far as putting the computer back into hibernation mode, I'm guessing
*that* is possible but I don't know off the top of my head how to do it.
If I were you, I would look in the documentation around the same sections
that deal with shutting down the computer. There's probably some class or
API dedicated to power management (which the hibernation would be a part
of).

Pete

Yes, it is possible to turn computer to the hibernate/switch it off.
Here are some examples of usage: http://forums.c-sharpcorner.com/F_ShowMessages.aspx?ThreadID=22968
or http://www.codeproject.com/csharp/timercomputershutdown.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top