I had an opportunity to present a session on “Using .NET Skills to Develop Mobile Applications with Compact Framework” at VTD on February 19, 2009. While I was able to answer few questions during the session, I am jotting down all of them here so that you get all the answers.

What is the difference between Windows Mobile and Pocket PC?

Pocket PC is software for personal digital assistants (PDAs). Pocket PC has both operating system (OS) and application components bundled specifically for PDAs. These include a set of system components from the Windows CE OS and application components, such as Microsoft® Pocket Internet Explorer, Microsoft® Pocket Word, Microsoft® Pocket Excel, and Microsoft® Pocket Outlook

Windows CE is a set of components that an OS developer uses to build a proprietary OS. Original equipment manufacturers (OEMs) who purchase Windows CE use Platform Builder, an integrated development environment, to assemble and compile an OS image. The image includes Windows CE and custom components, and custom device drivers. The OS image is then programmed into the read-only memory of a microprocessor chipset.

Windows CE is not restricted to Pocket PC devices. It is appropriate for cash registers, cellular telephones, medical instruments, and any other appliance that requires a small, embedded OS.

You can get detailed info about the differences and corresponding FAQs here.

What type of OS support .NET Compact Framework?

The Microsoft .NET Compact Framework (.NET CF) is a version of the .NET Framework that is designed to run on Windows CE based mobile/embedded devices such as PDAs, mobile phones, factory controllers, set-top boxes, etc

What is cHTML?

cHTML stands for Compact HTML and is designed  to meet the requirements of small information appliances. You can read more about it here.

When using Mobile Web forms, I was able to deploy & check it in the System's IE But how to check that in a Mobile Emulator?

1. Install Microsoft ActiveSync from http://www.microsoft.com/downloads/details.aspx?FamilyID=9e641c34-6f7f-404d-a04b-dc09f8141141&DisplayLang=en  
2. Then check to ensure DMA is enabled in Active Sync. To do that double click on the Active Sync Icon and Check the connection settings.
3. Make sure Allow Connection to one of the following is checked and it is set to DMA. If this is not set Virtual Cradle will NOT work.
4. Then start the emulator (Tool => Device Emulator Manager => Select Device => Right Click => Connect)
5. If the emulator is already running you will see an icon next to it showing it is running.
6. If not, the right click and say Connect. That will start the emulator.
7. Once running, Right click and select Cradle.
8. You will see Active Sync spring into action and establish connectivity with the emulator.
9. After this your machine actually believes it has a real device connected to it.

For Windows Vista onwards, you don't need Active Sync. You just need to do the following after installing Windows Mobile Device Centre:
Control Panel - Windows Mobile Device Centre -> Mobile Device Settings -> Connection Settings -> Allow connections to one of the following –> DMA
Then you can follow step 4 onwards as mentioned above.

You can also get more info on this at the following blog:

Visual Studio for Devices: http://blogs.msdn.com/vsdteam/archive/2005/10/07/478295.aspx

Where can I get the source code for the Calculator and Puzzle demos presented during the session?

You can download the samples from the MSDN site mentioned below:

Calculator: http://msdn.microsoft.com/en-us/library/besa58x7.aspx

Sliding Puzzle: http://msdn.microsoft.com/en-us/library/3c3t7946.aspx

There are also very good examples available at the following location on MSDN:

.NET Compact Framework Application Samples: http://msdn.microsoft.com/en-us/library/30taewf4.aspx

.NET Compact Framework 2.0 Samples: http://msdn.microsoft.com/en-us/netframework/aa497284.aspx

Where can I get the source code for the Automated SMS Reply demo presented during the session?

Mentioned below is the code snippet for the same:

using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;
using Microsoft.WindowsMobile.PocketOutlook;
 
namespace MySMSApp
{
    public partial class Form1 : Form
    {
 
        // For SMS Message Interception...
        MessageInterceptor _smsInterceptor = null;
   
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            //Adding Event Handler for intercepting Incoming Message
            _smsInterceptor = new MessageInterceptor(InterceptionAction.Notify);
            _smsInterceptor.MessageReceived += SmsInterceptor_MessageReceived;
        }
 
 
        void SmsInterceptor_MessageReceived(object sender, MessageInterceptorEventArgs e)
        {
            //This code is executed whenever you have a new incoming message.
            SmsMessage incomingMessage;
            try
            {
                //You can add your Business Logic here to generate appropriate Response
                incomingMessage = e.Message as SmsMessage;
                if (incomingMessage != null)
                {
                    SmsMessage _sms = new SmsMessage();
                    _sms.To.Add(incomingMessage.From);
                    _sms.Body = "Hello " + incomingMessage.Body + ": Thankyou for attending VTD Session!";
                    _sms.Send();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                incomingMessage = null;
            }
        }
    }
}

What are the pre-requisites for creating applications using .NET Compact Framework?

Absolutely nothing apart from Visual Studio with Emulators and .NET Compact Framework Installed. Although the following link talks about .NET Compact Framework 1.0, it should give you a good head start:

Getting Started with Visual Studio .NET and the Microsoft .NET Compact Framework: http://msdn.microsoft.com/en-us/library/aa446534.aspx

Getting Started: http://msdn.microsoft.com/en-us/netframework/aa497282.aspx

How to deploy your application on a Device?

Following link explains in detail the deployment process during Development and Deployment once Development is complete:

Deploying Smart Device Applications: http://msdn.microsoft.com/en-us/library/ms173409.aspx

Can we Develop .NET Compact Framework Apps using VS 2005?

Yes, you can.

What is the .NET Compact Framework comes with Windows Mobile 6.0?

There is no .NET Compact Framework which comes by default with Windows Mobile 6.0. You would have to install the same.

On what all kind of mobile phones will .NET Compact Framework Application work?

This will work on all Windows CE based mobile devices.

Is there any suggested Devices list on which .NET Compact Framework will work ?

The .NET Compact Framework is available as an operating system component in all Microsoft smart devices, including Pocket PC devices, Pocket PC Phone Edition, Smartphone devices, and other Windows Embedded CE powered devices.

Devices and Platforms Supported by the .NET Compact Framework: http://msdn.microsoft.com/en-us/library/ms172550.aspx

What are the performance counters available in .NET Compact Framework?

The .NET Compact Framework does not support PerformanceCounter objects because they do not pertain to Windows CE and the .NET Compact Framework. However, the .NET Compact Framework contains a set of predefined performance counters for analyzing the types of load your application has on the .NET Compact Framework. The counters are not extensible.

Performance and Diagnostics in .NET Compact Framework: http://msdn.microsoft.com/en-us/library/ms172524.aspx

Is mobile web form is not available with vs2008?

You can get the Mobile Web Form Templates for VS2008 from the Visual Web Developer Team Blog at the following link:

ASP.NET Mobile Development with Visual Studio 2008: http://blogs.msdn.com/webdevtools/archive/2007/09/17/tip-trick-asp-net-mobile-development-with-visual-studio-2008.aspx

Will these application work on both Windows OS v5.0 and v6.0 ?

Yes. The application will continue to run seamlessly as long as you have the .NET Compact Framework installed on the device.

Can we store the database in the mobile?

Yes. You can store data using SQL Server Compact Edition on Mobile Device.

The presentation and the video for the session should be available for the download on www.virtualtechdays.com in coming days. Apart from it, following links should be good reference:

.NET Compact Framework Dev Guide: http://msdn.microsoft.com/en-us/library/f44bbwa1.aspx

Differences Between the .NET Compact Framework and the .NET Framework: http://msdn.microsoft.com/en-us/library/2weec7k5.aspx

Windows Mobile Dev Centre: http://msdn.microsoft.com/hi-in/windowsmobile/default(en-us).aspx

Hope this helps!

Feel free to post a comment if you have any follow up questions.

Until Next Time,

~Punit