Академический Документы
Профессиональный Документы
Культура Документы
On This Page
Introduction
Getting Started with Windows Mobile 5.0 Developmnet
Windows Mobile 5.0 Productivity APIs
Introduction
Windows Mobile 5.0, the latest Microsoft operating system for mobile devices, was launched on the 11th of
May 2005 at the Mobile and Embedded Developers Conference, Las Vegas, USA. It represents a significant
step forwards with emphasis on increased user productivity, great multimedia support and increased options
for OEMs and operators to differentiate their device offerings.
The new operating system brings with it a whole slew of new API’s and interfaces that make application
development simpler and more powerful. However, the best news of all is the arrival of an integrated
development platform providing all the tools necessary to target this new release – Visual Studio 2005.
Although Visual Studio 2005 is currently in Beta you can use it to develop Windows Mobile 5.0 applications and even take them
to market. This article will explore:
Windows Mobile 5.0 also introduces new managed libraries that work with .NET Compact Framework programs in addition to the
expected Win32 API sets. Developers using C# or VB.NET can use these libraries from applications based on either version 1.0 or
version 2.0 of the Compact Framework. This article will describe these new libraries but will not cover libraries that are part of
the Compact Framework itself.
By the end of the article, you should have a basic understanding of the new features available for your use in developing the
next killer mobile application.
As Visual Studio 2005 is still a Beta product at this time, information provided in this article is subject to change. However,
Windows Mobile 5.0 is a released product and information is accurate at the time of writing.
Top of page
The installation steps below, downloads, additional tools and additional information can be found in the following MSDN article.
As a minimum, the following will provide you with a development environment that can be used to write programs for Windows
Mobile 5.0 devices.
This update changes the default communications method between the device emulators and Visual Studio from TCP/IP to
DMA (Direct Memory Access) with a marked improvement in performance since the TCP/IP network protocol stack is
eliminated and data is transferred directly via DMA.
3. Install ActiveSync 4.0 which is required for connections to Windows Mobile 5.0 devices. Note that the development
environment needs ActiveSync to support application deployment and debugging.
4. Finally install either or both the Windows Mobile 5.0 SDKs. There is one for Pocket PC development and another targeting
the Smartphone platform.
Each SDK provides headers, libraries, samples and most importantly emulators for testing your applications. These high-
fidelity emulators allow developers to test most functionality and are vital in the absence of new Windows Mobile 5.0
devices coming to market soon.
Once the above actions are completed new device targets will appear in the New Project Dialog for the language you have
selected.
Note the entries labelled Pocket PC Magneto and Smartphone Magneto. Magneto was the codename for Windows Mobile 5.0
during development and these entries will be changed to reflect the release version of the name in due course.
Now that we have the development environment ready, let’s have a look at what Windows Mobile 5.0 brings to mobile
developers.
As mentioned in the introduction section of this article, Windows Mobile 5.0 is really about three things – Increased Productivity,
Great Multimedia and Differentiation. Differentiation is primarily the domain of device manufacturers and cellular operators. We
will thus look at the APIs that application developers have access to in the areas of Productivity and Multimedia.
Top of page
not even have provided a means to get to the data. With Windows Mobile 5.0, the operating system has centralized its state
information into a single store. What is more, an API set is now exposed so that you can access state information in a standard
way. The new state store is based on the system registry and state is both recorded and monitored there.
The states provided by the operating system are extensive and covers among other things:
Additionally, you can extend the states tracked with custom states. The broker, through the API set, allows states to be changed
or monitored for change. When a change is detected, a notification is sent to an application that can then react accordingly.
You can have transient notifications, which work when the application requesting it is running. The notification takes the form of
a window message, a callback or message in a message queue. The following example uses the RegistryNotifyWindow API to
send a window message when phone signal strength changes.
#include
#include
RegistryNotifyWindow(
SN_PHONESIGNALSTRENGTH_ROOT,
SN_PHONESIGNALSTRENGTH_PATH,
SN_PHONESIGNALSTRENGTH_VALUE,
hWnd,
WM_MY_WINDOW_MESSAGE,
dwUserDefinedValue,
NULL,
&hNotify);
However, the more powerful version is persistent notifications. This type of notification will cause your application to be started
by the operating system if it isn’t already running. Use the RegistryNotifyApp API to request this.
NOTIFICATIONCONDITION nc;
nc.ctComparisonType = REG_CT_EQUAL;
nc.TargetValue.dw = 1;
nc.dwMask = 0xFFFFFFFF;
RegistryNotifyApp(
SN_CRADLEPRESENT_ROOT,
SN_CRADLEPRESENT_PATH,
SN_CRADLEPRESENT_VALUE,
TEXT("OSServices.CradlePresent"),
TEXT("\"\\Program Files\\OSServices\\OSServices.exe\""),
NULL,
NULL,
0,
0,
&nc);
Prior to Windows Mobile 5.0 access to PIM functionality required native C++ programming because no interface classes were
provided for Managed code to call. This was partly due to the lack of COM support in Compact Framework 1.0. With Compact
Framework 2.0 COM interoperability is available through runtime generated proxy classes so developers can access COM objects
directly if required. Additionally a new managed code library is available with Windows Mobile 5.0 that provides access to all PIM
functionality from both Compact Framework 1.0 and 2.0 applications. This new functionality can be found within the Microsoft.
WindowsMobile.PocketOutlook namespace and provides a streamlined object model that makes working with the PIM elements a
lot easier.
using Microsoft.WindowsMobile.PocketOutlook;
.
.
.
using(OutlookSession outlookSession = new OutlookSession())
{
Contact contact = new Contact();
contact.FirstName = "Joe";
contact.LastName = "Bloggs";
contact.MobileTelephoneNumber = "+00 (0) 123 456 7890";
outlookSession.Contacts.Items.Add( contact );
}
It is clear from the above code that the new model is extremely concise and readable.
Pocket PC Soft-keys
On Windows Mobile 5.0 Pocket PC devices, you will find the addition of two hardware keys in similar positions to those that exist
on the Smartphone today. These keys, called soft-keys, are designed to relate to menu items immediately above the keys
bringing a consistent look and feel across both Pocket PC and Smartphone platforms. Pocket PC applications can now lay out
their menu structure to take advantage of these keys and provide quicker access to application functionality for the user.
Top of page
©2005 Microsoft Corporation. All rights reserved. Terms of Use |Trademarks |Privacy Statement