Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Automatically Starting Your Application on Windows Mobile

, 31 Jul 2008
An article discussing the various methods that you can use to automatically start an application on Windows Mobile, either by schedule or in reaction to a system event.
WiMoAutoStart_Source.zip
ShowCommandLine
bin
Debug
ShowCommandLine.exe
Win32.dll
Properties
ShowCommandLine.csproj.user
TimedStart
bin
Debug
TimedStart.exe
Win32.dll
Properties
TimedStart.csproj.user
WakeUpStart
bin
Debug
WakeUpStart.exe
Win32.dll
Properties
WakeUpStart.csproj.user
Win32
bin
Debug
Win32.dll
Properties
Win32.csproj.user
using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Win32;

namespace WakeUpStart
{
    public partial class Form1 : Form
    {
        const int WakeUpEvent = 11;
        const int ClearEvent = 0;

        public Form1()
        {
            InitializeComponent();
        }

        private void CmdAccept_Click(object sender, EventArgs e)
        {
            if(chkAcPowerOff.Checked)
                CoreDLL.CeRunAppAtEvent(this.txtAppPath.Text, (int)WhichEvent.NOTIFICATION_EVENT_OFF_AC_POWER);
            if(chkAcPowerOn.Checked)
                CoreDLL.CeRunAppAtEvent(this.txtAppPath.Text, (int)WhichEvent.NOTIFICATION_EVENT_ON_AC_POWER);
            if(chkActiveSyncEnd.Checked)
                CoreDLL.CeRunAppAtEvent(this.txtAppPath.Text, (int)WhichEvent.NOTIFICATION_EVENT_SYNC_END);
            if(chkNetworkConnected.Checked)
                CoreDLL.CeRunAppAtEvent(this.txtAppPath.Text, (int)WhichEvent.NOTIFICATION_EVENT_NET_CONNECT);
            if(chkWakeUp.Checked)
                CoreDLL.CeRunAppAtEvent(this.txtAppPath.Text, (int)WhichEvent.NOTIFICATION_EVENT_NET_CONNECT);
        }

        private void cmdClear_Click(object sender, EventArgs e)
        {
            CoreDLL.CeRunAppAtEvent(this.txtAppPath.Text, (int)WhichEvent.NOTIFICATION_EVENT_NONE);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.InitialDirectory="\\Program Files";
            ofd.Filter="Executables |*.exe";
            if(DialogResult.OK==ofd.ShowDialog())
            {
                this.txtAppPath.Text = ofd.FileName;
            }
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Joel Ivory Johnson
Software Developer Razorfish
United States United States
I attended Southern Polytechnic State University and earned a Bachelors of Science in Computer Science and later returned to earn a Masters of Science in Software Engineering.
 
For the past few years I've been providing solutions to clients using Microsoft technologies for web and Windows applications.
 
While most of my CodeProject.com articles are centered around Windows Phone it is only one of the areas in which I work and one of my interests. I also have interest in mobile development on Android and iPhone. Professionally I work with several Microsoft technologies including SQL Server technologies, Silverlight/WPF, ASP.Net and others. My recreational development interest are centered around Artificial Inteligence especially in the area of machine vision.
 
Follow on   Twitter

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 31 Jul 2008
Article Copyright 2008 by Joel Ivory Johnson
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid