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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.