Prevent automatic power off in C#

Ok, I have a fancy C# mobile application that syncs my company's database to our mobile phones. Depending on the ammount of data, sometimes this can take between 5 - 10 minutes. My problem is that our devices will power off after 3 minutes of being idle. I do not want to change this, because normally this is a very good thing, but it can be a real pain in the neck when this program is running.

Windows Mobile 5.0, .NET CF 2.0 and C#.

I need a way to programmically prevent the device from being powered off for any reason while my Sync() preocess is running and then be able to bring it back to it's original state after the process is done.

I assume that I will need to trap a windows message, but I can't find the right one to do this.

Thanks in advance for you help.
Who is Participating?

I don't have that much information but i found this link hope it may work for you

Thandava VallepalliCommented:
You can programatically delay the shutdown using windows command


look at it

Rickggoalie3Author Commented:
SystemExpert: Thats looks like what I'll need. I hope you don't mind if I wait to assign points until I can try out the code tonight.

itsvtk: Please not the O/S. My program is running on WindowsMobile 5.0 not windows Xp. :)
Rickggoalie3Author Commented:
SystemExpert thank you so much for your help. Iv'e got a little work to do to port this to C#, but this is exactly what I needed.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.