Link to home
Start Free TrialLog in
Avatar of retinax
retinax

asked on

Run a C# .NET Compact Framework Application in Background

Hi,

I am writing a SMS/Contact backup application, it need to run in the background (may be with an icon in the notification area)? What can I do to achieve it? Say FormBackup need to stay in memory, with a timer, that checks for new SMS etc and does the backup. How can I prevent user from clicking the X button to close it, and only Hide the form.

Thanks
Avatar of angus_young_acdc
angus_young_acdc
Flag of United Kingdom of Great Britain and Northern Ireland image

In your Form_Load put the following:

            this.ControlBox = false; // Hides the minimize, X etc at the top of your form
            this.Hide();             // Will hide the form
Avatar of retinax
retinax

ASKER

Ok cool, thanks.

Any idea on the Notification area icon thing?

Create NotifyIcon and ContextMenuStrip controls on the form.
Set setNotifyIcon's ContextMenuStrip property to your context menu.
Set NotifyIcon's Icon property to icon of your choice and set it's Visible property to true.
Create a 'Show form' menu in your context menu strip and fill it with this code:



        private void showFormToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Normal;
            this.Visible = true;
        }

Open in new window

Avatar of retinax

ASKER

Thanks, are those controls available only in WM6 professional sdk not standard edition??
ASKER CERTIFIED SOLUTION
Avatar of dbrckovi
dbrckovi
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial