Prevent automatic power off in C#

Background:
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.

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

Problem:
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.
LVL 2
Rickggoalie3Asked:
Who is Participating?
 
SystemExpertCommented:
Hi,

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

http://www.codeguru.com/cpp/w-p/ce/memorymanagement/article.php/c11113/

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

shutdown  


look at it

http://aumha.org/win5/a/shutcut.php

itsvtk
0
 
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. :)
0
 
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.
0
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.