Prevent automatic power off in C#

Posted on 2006-04-18
Last Modified: 2011-10-03
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.
Question by:Rickggoalie3
    LVL 10

    Accepted Solution


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

    LVL 14

    Expert Comment

    by:Thandava Vallepalli
    You can programatically delay the shutdown using windows command


    look at it

    LVL 2

    Author Comment

    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. :)
    LVL 2

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Article by: Ivo
    C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now