Code Samples for Windows Mobile

Windows Mobile SupportedWindows Embedded CE Not Supported

8/28/2008

The Windows Mobile Software Developer's Kit (SDK) ships with over a hundred code samples. These are working applications that can help you learn to develop software for the Windows Mobile platform.

The code samples are installed when you install the Windows Mobile 6 Professional SDK and the Windows Mobile 6 Standard SDK . Each SDK ships with code samples that are common to both platforms, as well as samples that are specific to each platform.

By default, the Windows Mobile 6 Professional code samples are copied to the folder

C:\Program Files\Windows Mobile 6 SDK\Samples\Pocket PC\

By default, the Windows Mobile 6 Standard code samples are copied to the folder

C:\Program Files\Windows Mobile 6 SDK\Samples\Smartphone\

By default, common code samples are copied to the folder

C:\Program Files\Windows Mobile 6 SDK\Samples\Common\

The majority of the code samples are C++ Win32 applications. These are found in the CPP subfolder. To use a code sample, navigate to the solution file (*.sln) you want to study, and double-click it. Microsoft Visual Studio 2005 launches, loading the solution. You can then build the solution, modify it, and deploy it.

Note

For your convenience, each code sample topic contains the default fully-qualified path-name of the associated solution file.If you set up your development environment using the defaults, you can simply copy this information to the Clipboard, and then paste it into the Run dialog box to launch it in Visual Studio.

Note

If an error is generated when building the samples, please try copying them to another location.

The following table contains a detailed listing of the code samples included with the Windows Mobile 6 Professional SDK and the Windows Mobile 6 Standard SDK.

Feature Area Code Sample Topic Language Windows Mobile 6 Professional Windows Mobile 6 Standard APIs Used Description

ActiveSync

Sync Manager

C++ Win32

x

x

ActiveSyncStart, ActiveSyncStop

Launches and terminates sync sessions. Displays the use of State and Notification APIs to register for changes to the two sync related Status Entries.

Folder : \Common\CPP\Win32\SyncManager

Camera

Camera Capture Graph

C++ Win32

x

 

ICaptureGraphBuilder2 Interface

Demonstrates the basic video capture functionalities using the native Camera APIs. Captures and encodes a video clip in WMV format. Captures and encodes a still image in jpeg format.

Folder : \PocketPC\CPP\win32\CameraCapture

 

Camera Capture

C++ Win32

x

x

SHCameraCapture

Take pictures and videos using the native Camera Capture API.

Folder : \Common\CPP\Win32\CECamera

 

Camera Capture

C#

x

x

Microsoft.WindowsMobile.Forms.CameraCaptureDialog

Demonstrates how to take pictures and videos using the CameraCaptureDialog managed API.

Folder: \Common\CS\CECamera

Cellcore

Telephone Dialer

C++ Win32

x

x

lineInitialize, lineNegotiateAPIVersion, lineGetDevCaps, lineDrop, lineDeallocateCall, lineClose

Demonstrates how to dial a call with a modem using TAPI.

Folder : \Common\CPP\Win32\CellCore\CeDialer

 

Synchronous TAPI

C++ Win32

x

x

lineNegotiateAPIVersion, lineGetDevCaps, lineGetGeneralInfo, lineInitializeEx, lineOpen, lineClose, lineShutdown

Demonstrates ExTAPI functionality.

Folder : \Common\CPP\Win32\CellCore\ExTAPI

 

Asynchronous TAPI

C++ Win32

x

x

lineNegotiateAPIVersion, lineGetDevCaps, lineGetGeneralInfo, LINEINITIALIZEEXPARAMS, lineNegotiateExtVersion, lineGetOperatorStatus, lineOpen, lineClose, lineShutdown

Demonstrates ExTAPI asynchronous functionality.

Folder : \Common\CPP\Win32\CellCore\ExTAPIAsync

 

Hello (SMS)

C++ Win32

x

x

SmsSendMessage

Demonstrates simple SMS message Sender.

Folder : \Common\CPP\Win32\CellCore\SMS\HelloSMS

 

Hello (Telephone)

C++ Win32

x

x

tapiRequestMakeCall

Demonstrates simple TAPI dialer.

Folder : \Common\CPP\Win32\CellCore\TAPI\HelloTAPI

 

Sending Data over SMS

C++ Win32

x

x

WapOpen, WapSend, WapRead, WapClose

Demonstrates both sending and receiving data via the Wireless Datagram Protocol (WDP) over Short Messaging Service (SMS).

Folder : \Common\CPP\Win32\CellCore\WDP_SMS

Phone and Communications

Bluetooth Device Discovery

C++ Win32

x

 

Bluetooth, Implementing Synchronous Device Discovery, WSALookupServiceBegin (Windows Sockets), WSALookupServiceNext (Windows Sockets), WSALookupServiceEnd (Windows Sockets)

Provides an implementation of simple Bluetooth device discovery via the Winsock 2 API.

Folder : \PocketPC\CPP\win32\Bluetooth\btsearch

 

Chatting over Bluetooth

C++ Win32

x

 

Bluetooth, Implementing Asynchronous Device Discovery

Demonstrates how to create peer-to-peer communications between two devices using Bluetooth wireless technology.

Folder : \PocketPC\CPP\win32\Bluetooth\BthChat

 

Bluetooth Game

C#

x

x

System.Drawing,Microsoft.WindowsMobile.SharedSource.Bluetooth

Demonstrates how to use the Windows Embedded Source Tools for Bluetooth Technology.

Folder: \Common\CS\Bluetooth\SpaceWar2D

 

Connection Manager Helper

C++ MFC

x

 

ConnMgrEstablishConnection, ConnMgrConnectionStatus, ConnMgrReleaseConnection, ConnMgrMapURL, ConnMgrProviderMessage

Demonstrates how to write a simplified Connection Manager client by deriving functionality from a helper class.

Folder : \PocketPC\CPP\MFC\CMHELPER

 

Time Server Synchronization

C++ Win32

 

x

ConnMgrReleaseConnection, ConnMgrEnumDestinations, ConnMgrEstablishConnection

Demonstrates how to use Connection Manager to establish a connection to a Time Server, and synchronize the device's internal clock.

Folder : \Smartphone\CPP\Win32\CMTime

 

WDP over SMS

C++ Win32

x

x

WapOpen, WapSend, WapRead, WapClose

Demonstrates how to send and receive data using the Wireless Datagram Protocol (WDP), over the Short Messaging Service (SMS) transport.

Folder : \Common\CPP\Win32\CellCore\WDP_SMS

 

WAP at WDP Layer

C++Win32

x

x

WapOpen, WapSend, WapRead, WapClose, WapGetNextPrimitiveSize

Demonstrates how to use the WAP APIs at the WDP Layer.

Folder : \Common\CPP\Win32\WDP

 

Ring Tone Manager

C#

x

x

SndGetSoundDirectoriesList, SndPlaySync, SndPlayAsync, SndOpen, SndStop, SndClose, PInvoke

Scans the device for audio files and also lets you copy those files to a directory where they will be recognize as a ring tone file. It PInvokes SndPlayAsync in order to preview the ringtones.

Folder : \Common\CS\RingtoneManager

Device Configuration and Security

WAP Provisioning Client

C++ Win32

 

x

DMProcessConfigXML

Loads WAP provisioning XML from a string resource and passes it to DMProcessConfigXML.

Folder : \Common\CPP\Win32\CfgClient

 

Setup in a CAB

C++ Win32

x

x

Installation Functions, CreateProcess

Demonstrates a user-interactive sample of a setup.dll that can be included in CAB files to perform complex operations.

Folder : \Common\CPP\Win32\SetupDLL

 

Viewing Security Settings

C#

x

x

ProcessConfiguration, TestConfiguration

Demonstrates how work with security policies and certificates.

Folder : \Common\CS\SecurityViewer

 

Custom Authentication Reset Component

C++

x

 

ARCSetup, ARCRequest, ARCGetValue

Demonstrates how to create a custom Authentication Reset Component (ARC).

Folder : \PocketPC\CPP\win32\AuthReset

 

LAP Plug-in for Windows Mobile Professional

C++Win32

x

 

InitLAP (function), DeinitLAP, VerifyUser (LAP), VerifyUserStart, VerifyUserToTop, LAPCreateEnrollmentConfigDialog, LAPCancelVerifySequence, LAPDisplayCodeword, LAPDisplayPreWipe, LAPLockoutUser, LASSGetValue

Implements a LAP plug-in, including all optional LAP APIs.

Folder : \PocketPC\CPP\win32\LAP

 

LAP Plug-in for Windows Mobile Standard

C++Win32

x

 

InitLAP (function), DeinitLAP, VerifyUser (LAP), VerifyUserStart, VerifyUserStop, VerifyUserToTop, LAPCreateEnrollmentConfigDialog, LAPCancelVerifySequence, LAPDisplayCodeword, LAPDisplayPreWipe, LAPLockoutUser, LASSGetValue

Implements a LAP plug-in, including all optional LAP APIs.

Folder : \Smartphone\CPP\win32\LAP

Direct 3D Mobile

D3D Create Device

C++ Win32

x

 

Direct3D Mobile Application Development

Creates a Direct3D device and uses it to clear the window.

Folder :\PocketPC\CPP\win32\Directx\d3dm\tutorials\tut01_createdevice

 

D3D Vertices

C++ Win32

x

 

Direct3D Mobile Application Development, IDirect3DMobileDevice::CreateVertexBuffer

Demonstrates the way vertices are transformed (meaning they are already in 2D window coordinates) and lit (meaning we are not using Direct3D Mobile lighting, but are supplying our own colors).

Folder : \PocketPC\CPP\win32\Directx\d3dm\tutorials\Tut02_vertices

 

D3D Matrices

C++ Win32

x

 

Direct3D Mobile Application Development, IDirect3DMobileDevice::SetTransform

Demonstrates the use of 4x4 matrices to transform the geometry with translations, rotations, scaling, and setting up our camera.

Folder : \PocketPC\CPP\win32\Directx\d3dm\tutorials\Tut03_matrices

 

D3D Dynamic Lighting

C++ Win32

x

 

Direct3D Mobile Application Development, D3DMLIGHT, IDirect3DMobileDevice::LightEnable

Demonstrates how to render 3D geometry with dynamic lighting.

Folder : \PocketPC\CPP\win32\Directx\d3dm\tutorials\Tut04_lights

 

D3D Texture Mapping

C++ Win32

x

 

Direct3D Mobile Application Development, IDirect3DMobileDevice::SetTexture, IDirect3DMobileDevice::SetTextureStageState

Demonstrates how to render texture-mapped 3D geometry.

Folder : \PocketPC\CPP\win32\Directx\d3dm\tutorials\Tut05_textures

 

D3D Fixed Point Data

C++ Win32

x

 

Direct3D Mobile Application Development

Demonstrates how to accept both floating point and fixed point (16.16) data types.

Folder : \PocketPC\CPP\win32\Directx\D3DM\tutorials\Tut06_fixedpoint

Direct Draw

DDraw Initialization

C++ Win32

x

 

DirectDraw

Demonstrates how to initialize DirectDraw and create a DirectDraw surface.

Folder : \PocketPC\CPP\win32\Directx\DDraw\DDex1

 

DDraw and Bitmaps

C++ Win32

x

 

DirectDraw

Demonstrates how to add a bitmap. Extends DDex1.

Folder : \PocketPC\CPP\win32\Directx\DDraw\Ddex2

 

DDraw Off-Screen Surfaces

C++ Win32

x

 

DirectDraw

Demonstrates the use of off-screen surfaces.

Folder : \PocketPC\CPP\win32\Directx\DDraw\Ddex3

 

DDraw and Audio

C++ Win32

x

 

DirectDraw

Demonstrates how to combine DirectDraw and waveform audio.

Folder : \PocketPC\CPP\win32\Directx\DDraw\Donuts2

 

DDraw and Animation

C++ Win32

x

 

DirectDraw

Demonstrates DirectDraw animation using overlays.

Folder : \PocketPC\CPP\win32\Directx\DDraw\Mosquito

DPI Awareness

Crossword

C++ Win32

x

 

ChangeDisplaySettingsEx, WM_SETTINGCHANGE, WM_SIZE, GetDeviceCaps, GetSystemMetrics, SHGetUIMetrics

Demonstrates how to convert a basic application into a high DPI aware application and into a landscape/portrait aware application.

Folder : \PocketPC\CPP\win32\Crossword

 

Screen Resolution

C++ Win32

x

 

Developing DPI Aware Applications

As you are developing applications for new high-resolution devices with 192 DPI resolution displays, you might wonder where the new high-resolution bitmaps and resources should go. The simplest solution is to include them in the same EXECUTABLE alongside the old, low-resolution resources. However, this approach wastes storage space. Device screens only have one resolution, which never changes for that device. Therefore, if the application is deployed to a 96 DPI device, it doesn't need 192 DPI resources - and vice versa.

Folder : \PocketPC\CPP\win32\Resdll

EDB

CEDB to EDB Migration

C++Win32

x

x

EDB Reference, CeOidGetInfoEx2 (EDB), CeMountDBVol (EDB), CeCreateDatabaseWithProps (EDB), CeCreateSession (EDB), CeOpenDatabaseInSession (EDB), CeSeekDatabaseEx (EDB)

Demonstrates how an application that used CEDB can been ported to use EDB.

Folder : \Common\CPP\Win32\FileDB

FileDRM

DRM Files

C++ Win32

x

x

FileDrmIsDRM, FileDrmShowLicenseInfo, FileDrmVerifyRights, FileDrmCreateFile, FileDrmGetMetric, FileDrmCommitRights

Demonstrates how to use the FileDRM APIs.

Folder : \Common\CPP\Win32\FileDRM

Imaging

Imaging Sample

C++ Win32

x

x

IImage, IImagingFactory

Demonstrates how to use the imaging.dll to load and display an image file.

Folder : \Common\CPP\Win32\Imaging

Internet Explorer Mobile

AXSample

C++ ATL

x

x

ActiveX Controls, ATL, COM

Demonstrates how to use ATL to create an ActiveX control, and how to access it in a web page.

Folder : \Common\CPP\ATL\AXSample

 

Web Browsing

C++ Win32

x

 

HTML Control API

Demonstrates the use of the HTML Viewer control, including the use of the DTM_NAVIGATE message to cause the control to download and display content from a URL.

Folder : \PocketPC\CPP\win32\browse

 

The Browser Helper Object (BHO)

C++ ATL

x

x

IWebBrowser2, DWebBrowserEvents2

Demonstrates now to create a Browser Helper Object (BHO), which Internet Explorer Mobile loads each time it starts up.

Folder : \Common\CPP\ATL\PIEHelper

 

Using Internet Explorer Mobile In Your Application

C++ ATL

x

x

IWebBrowser2, DWebBrowserEvents2

Demonstrates how to reuse the Internet Explorer Mobile web browser in a mobile application.

Folder : \Common\CPP\ATL\MiniPIE

Menu extensions, POOM Named Properties

Medical History

C++ Win32

x

 

IItem::SetProps, IPOutlookApp2::GetIDsFromNames, IPOutlookApp2, IPOutlookApp2::GetItemFromOidEx, IItem, IContextMenu, IObjectWithSite

Demonstrates how to add a menu extension to the contacts summary card.

Folder : \PocketPC\CPP\win32\MedicalHistory

Message Queuing

Message Queuing Sample

C++ Win32

x

x

Using the MSMQAdm Utility, Debugging MSMQ Installations, MSMQ Reference

Demonstrates how to use message queuing (MSMQ). It is a visual wrapper around MSMQADM.exe.

Folder : \Common\CPP\Win32\MSMQ\VisAdm

Messaging (MAPI)

Push Messaging

C++ Win32

x

x

ShellExecuteEx

Demonstrates a push client that receives a push message and saves the message's body into a file and then calls ShellExecuteEx on that file.

Folder : \Common\CPP\Win32\FileClient

 

Set Message Store Properties

C++ Win32

x

x

IMAPISession, IMAPITable, IMAPIProp::GetProps, IMAPIProp::SetProps

Demonstrates how to use IMsgStore::GetProps and IMsgStore::SetProps how to retrieve and set properties on message stores.

Folder : \PocketPC\CPP\win32\MailSet

 

MAPI Rules

C++ Win32

x

x

IMailRuleClient, IMailRuleClient::ProcessMessage, IMailRuleClient::Initialize, IMsgStore, IMsgStore::OpenEntry, IMessage, IMAPIProp::GetProps, MAPI Properties

Demonstrates how to implement a MAPI Rule Client, a COM object which can handle and filter incoming MAPI messages.

Folder : \Common\CPP\Win32\MapiRule

 

Read View Menu Extension

C++ Win32

x

x

IContextMenu, IObjectWithSite, MailComposeMessage

Demonstrates how to reply to an email message using a default email account.

Folder : \Common\CPP\Win32\ReadViewMenuExt

 

Sending E-mail

C++ Win32

x

x

Messaging API (CE MAPI) Reference, MAPILogonEx, CbSRowSet, IMAPISession::GetMsgStoresTable, IMAPISession::OpenMsgStore, IMAPITable::QueryRows, IMsgStore::OpenEntry, IMAPIProp::GetProps, IMAPIFolder::CreateMessage, IMessage::SubmitMessage, MAPIFreeBuffer, FreeProws

Demonstrates how to use several CEMAPI APIs.

Folder : \Common\CPP\Win32\SendMail

 

New Messaging Transport

C++ Win32

x

 

IMailSyncHandler

Demonstrates how to create a new messaging transport.

Folder : \PocketPC\CPP\win32\TransportDemo

 

New Message Class

C++ Win32

x

 

IFormProviderEx, IMailRuleClient

Implements a new message class appropriate for SMS notifications from your DVR.

Folder : \PocketPC\CPP\win32\TV_Inbox

Phone

Calling Card

C++ Win32

 

x

PhoneMakeCall, IContextMenu::QueryContextMenu

Demonstrates how to make a calling card call directly from the Contacts screen.

Folder : Common\CPP\Win32\CallingCard

 

Get Device's Phone Number

C++ Win32

x

x

IWebBrowser2, DWebBrowserEvents2

Demonstrates how to retrieve the phone number of a device.

Folder : \Common\CPP\Win32\GetPhoneNumber

 

Find a Lost Phone

C#, VB

 

x

State and Notifications Broker, Microsoft.WindowsMobile.PocketOutlook.MessageInterception, Microsoft.WindowsMobile.Status, PlaySound, PInvoke

Demonstrates how to write an application that helps you locate your phone if you lose it.

Folder : \Smartphone\CS\PhoneFinder

Folder : \Smartphone\VB\PhoneFinder

 

Manage SIM Contacts

C++ Win32

 

x

SIM Manager Reference, SimDeinitialize, SimGetDevCaps, SimInitialize, SimReadPhonebookEntry, Telephony

Demonstrates how to add phone numbers to, and delete phone numbers from, a Subscriber Identity Module (SIM).

Folder : \Smartphone\cpp\Win32\SIMMgr

POOM

Calendar List View

C++ Win32

x

 

CEPROPVAL, GetCursor, IDispatch, IFolder, IItem, InitCommonControlsEx (function), INITCOMMONCONTROLSEX (structure), IPOutlookApp2, IPOutlookItemCollection, LoadCursor, LVCOLUMN, LVITEM, MSG, SetCursor, SHINITDLGINFO, SHMENUBARINFO

Demonstrates how to use the POOM IItem interface for appointment items, and POOM notifications. It displays a list-view with all calendar items.

Folder : \PocketPC\CPP\win32\CalendarView

 

Picture Dialer

C++ Win32

x

x

Pocket Outlook Object Model (POOM), ChooseContact

Demonstrates how to associate a phone number and picture with a digit in a grid. Pressing the digit will dial the phone number.

Folder : \Common\CPP\Win32\PictureDialer

 

Register a Source Provider

C++ Win32

x

 

CEPROPVAL, IPimSrcContactListIcon::Paint, IPimSrcContactSummaryCard::Display, PIMSRC_COLOR, Source Provider Customization Type Flags

The following application registers a source provider for the Contacts and Calendar applications.

Folder : \PocketPC\CPP\win32\PimExProvider

 

POOM Master

C++ Win32

x

x

Pocket Outlook Object Model (POOM), IPOutlookApp, IPOutlookItemCollection, ITask, IContact, IAppointment, ListView_InsertItem, Date and Time Picker Controls Reference

Demonstrates how to use the POOM API. Via an owner-drawn list-view control, POOMMaster displays currently stored PIM items (Contacts, Tasks, and calendar Appointments).

Folder : \Common\CPP\Win32\PoomMaster

 

Manage Tasks

C++ Win32

 

x

IPOutlookItemCollection, IRecurrencePattern, ITask

Demonstrates how to write a Personal Information Manager (PIM)/Messaging application that uses API members from the Pocket Outlook Object Model (POOM) to create, delete, and otherwise manage tasks.

Folder : \Smartphone\cpp\Win32\poomtasks

 

Task Tree

C++ Win32

x

 

Pocket Outlook Object Model (POOM)

Demonstrates how to display tasks in a tree view. Enables user to add new tasks to the tree.

Folder : \PocketPC\CPP\win32\TaskTree

 

POOM Application

C#

x

 

Microsoft.WindowsMobile.PocketOutlook, Microsoft.WindowsMobile.Telephony

Demonstrates how to write a Personal Information Manager (PIM)/Messaging application that uses API members from the Microsoft.WindowsMobile.PocketOutlook namespace, along with API members from the Microsoft.WindowsMobile.Telephony namespace.

Folder : \PocketPC\CS\Pocketoutlooksample

 

Add Contacts' Birthdays to Calendar

C#

x

x

Microsoft.WindowsMobile.PocketOutlook, Microsoft.WindowsMobile.PocketOutlook.Appointment, Appointment.RecurrencePattern

Demonstrates how to write a managed Pocket Outlook Object Model (POOM) application.

Folder : \Common\CS\BirthdaysToCalendar

 

Add Picture to Contact

C#

x

x

Microsoft.WindowsMobile.Forms.ChooseContactDialog,Microsoft.WindowsMobile.Forms.SelectPictureDialog,Microsoft.WindowsMobile.PocketOutlook.OutlookSession,Microsoft.WindowsMobile.PocketOutlook.Contact

Demonstrates how to use the ChooseContactDialog and the SelectPictureDialog APIs to select a contact and then attach a picture to it.

Folder : \Common\CS\AddPictureToContact

 

Send Meeting Requests Over SMS

C#

x

 

Pocket Outlook Object Model (POOM), Microsoft.WindowsMobile.PocketOutlook Namespace

Demonstrates how to use custom controls to pick an Appointment and a Contact, then send a meeting request to the Contact over SMS.

Folder : \PocketPC\CS\AppointmentOverSms

 

SMSIM

C#

x

x

Pocket Outlook Object Model (POOM), MessageInterceptor Class

Demonstrates how to use C# to write a managed code version of a Short Messaging Service (SMS) interception application.

Folder : \PocketPC\CS\SmsIm

Folder : \Smartphone\CS\SmsIM

POOM, PicturePicker

Add a Contact Picture

C++ Win32

x

x

ChooseContact, GetOpenFileNameEx, IItem

Demonstrates how to allow the user to select a contact (using the Contact Chooser), select a picture (using the Picture Picker), and then adds the selected picture to the selected contact, and displays the summary card for that contact.

Folder : \Common\CPP\Win32\AddContactPicture

POOM, MAPI

Rules Client Custom Form

C++ Win32

x

x

IMailRuleClient, IFormProviderEx

Demonstrates how to implement a Rule Client to capture and process SMS/EMS, process multipart EMS, and implement a custom read form to display the EMS in the Inbox application.

Folder : \Common\CPP\Win32\CustomForm

Power Management

Power Manager

C++ Win32

x

x

RequestPowerNotifications, StopPowerNotifications, SetPowerRequirement, ReleasePowerRequirement, GetSystemPowerState, SetSystemPowerState

Demonstrates how an application can use the Power Manager APIs to register for power notifications, set minimum device power requirements, and get and set the system power state.

Folder : \Common\CPP\Win32\PowerManager

RAPI

CE Invoke

C++ Win32

x

 

CeRapiInvoke (RAPI)

Demonstrates how to use the CEInvoke API for the client, and for the server.

Folder : \PocketPC\CPP\win32\Ceinvoke

 

Get Device Information

C++ Win32

x

x

IRAPIDesktop::EnumDevices, IRAPIDevice::GetConnectionInfo, IRAPIDevice::GetDeviceInfo

Demonstrates how to use the IRAPI interfaces to get information about the Windows Mobile powered device connected through ActiveSync and the corresponding communication medium used. Once the information is collected, it is printed on the console window.

Folder : \Common\CPP\Win32\Rapi\DeviceInfo

 

List a Directory and its Files

C++ Win32

x

x

CeRapiInit (RAPI), CeFindFirstFile (RAPI), CeFindNextFile (RAPI), CeFindClose (RAPI), CeRapiUninit (RAPI)

This application runs on a desktop host computer, and demonstrates how to list a directory's files and directories on a Mobile device.

Folder : \Common\CPP\Win32\Rapi\Pdir

 

Copy a File from a Device

C++ Win32

x

x

CeRapiInit (RAPI), CeReadFile (RAPI), CeCloseHandle (RAPI), CeRapiUninit (RAPI)

This application runs on a desktop host computer, and demonstrates how to copy a file from a Mobile device to a desktop computer.

Folder : \Common\CPP\Win32\Pget

 

Copy a File to a Device

C++ Win32

x

x

CeRapiInit (RAPI), CeWriteFile (RAPI), CeCloseHandle (RAPI), CeRapiUninit (RAPI)

This application runs on a desktop host computer, and demonstrates how to copy a file from the desktop computer to a Mobile device.

Folder : \Common\CPP\Win32\Pput

 

Retrieve Registry Settings

C++ Win32

x

x

CeRapiInit (RAPI), CeRegEnumKeyEx (RAPI), CeRegOpenKeyEx (RAPI), CeRegEnumValue (RAPI), CeRegCloseKey (RAPI), CeRapiUninit (RAPI)

This application runs on a desktop host computer, and demonstrates how to retrieve a Mobile device's list of registry settings.

Folder : \Common\CPP\Win32\Pregdmp

 

Execute an Application on a Device

C++ Win32

x

x

CeRapiInit (RAPI), CeCreateProcess (RAPI), CeCloseHandle (RAPI), CeRapiUninit (RAPI)

This application runs on a desktop host computer, and demonstrates how to execute an executable file on a Mobile device.

Folder : \Common\CPP\Win32\Prun

 

List all Directories and their Files

C++ Win32

x

x

CeRapiInit (RAPI), CeFindAllFiles (RAPI), CeRapiFreeBuffer (RAPI), CeRapiUninit (RAPI)

This application runs on a desktop host computer, and demonstrates how to list all of the files and directories on a Mobile device.

Folder : \Common\CPP\Win32\Ptree

 

Communication with Sockets

C++ Win32

x

x

IRAPIDesktop::EnumDevices, IRAPIDevice::GetConnectionInfo

Demonstrates how to use sockets to communicate with a Windows Mobile powered device. At first hand, the application uses IRAPI interfaces to get the IP of the device connected through ActiveSync. In a second step, it sends a hello string and listen for the mobile device to respond back

Folder : \Common\CPP\Win32\SockApp

 

RAPI EDB Database Application

C++Win32 

x

x

Remote API (RAPI), EDB Reference

Demonstrates how to use RAPI to access EDB databases.

Folder : \Common\CPP\Win32\Rapi\EdbRapi

Shell

Card Autorun

C++ Win32

x

x

SHGetAutoRunPath

Demonstrates how to handle Autorun notifications when an MMC card is inserted/removed from the mobile device.

Folder : \Common\CPP\Win32\Autorun

 

Basic Shell

C++ Win32

x

x

RegisterClass, CreateWindow, SetForegroundWindow, SHCreateMenuBar, SHInitDialog, SHGetUIMetrics, SHHandleWMActivate, SHHandleWMSettingChange, SHLoadImageResource, WM_HIBERNATE

Demonstrates how to implement a basic application that uses the major Shell APIs to interact properly with Windows Mobile .

Folder : \Common\CPP\Win32\BasicApp

 

Calendar and DTP Controls

C++ Win32

x

 

Date and Time Picker Controls Reference

Demonstrates how to use the Calendar and date and time picker controls.

Folder : \PocketPC\CPP\win32\CalendarAndDTP

 

Context Menu Extension Handler

C++ Win32

x

 

IContextMenu

Demonstrates how to implement a context menu extension handler, and specifically one that extends the context menu in File Explorer when tapping and holding on a file.

Folder : \PocketPC\CPP\win32\CtxMenu

 

Currency Converter

C++ Win32

 

x

CreateMutex, SHCreateMenuBar, SetFocus

Demonstrates how to port an application written for Windows Mobile 6 Professional , and port it to Windows Mobile 6 Standard .

Folder : \Smartphone\cpp\Win32\Currency

 

File System Browser

C++ Win32

x

 

FindFirstFile, FindNextFile, Tree View Controls Reference

Demonstrates how to browse the file system and display all directories and files by name.

Folder : \PocketPC\CPP\win32\DirTree

 

Dynamic Menu

C++ Win32

x

 

CheckMenuRadioItem, CheckMenuItem, InsertMenu, DeleteMenu

Demonstrates techniques for using, getting, and setting menu handles on Windows Mobile 6 Professional .

Folder : \PocketPC\CPP\win32\Dynamenu

 

File Change Notification

C++ Win32

x

 

SHChangeNotifyRegister, SHChangeNotifyDeregister

Demonstrates how to listen for changes to the file system.

Folder : \PocketPC\CPP\win32\FileChangeNotif

 

Full Screen

C++Win32

x

x

SHFullScreen, SHCMBM_OVERRIDEKEY

Demonstrates how an application can make full use of the device screen for displaying content using several shell APIs.

Folder : \Common\CPP\Win32\FullScreen

 

SIP Handles

C++ Win32

x

 

SipGetInfo, Common Controls Reference, Software-based Input Panel

Demonstrates how to use SIP functions.

Folder : \PocketPC\CPP\win32\HandleSIP

 

HTML Viewer Host

C++ Win32

x

 

Creating HTML Control

Demonstrates the programmatic accessibility of the HTML Viewer control and produces debug output based on the user actions within the control.

Folder : \PocketPC\CPP\win32\HTMLHost

 

Hardware Navigation

C++ Win32

x

 

WM_GETDLGCODE

Demonstrates how focus moves around a dialog when the user performs various hardware navigation actions.

Folder : \PocketPC\CPP\win32\HWNavigation

 

Inbox Menu Extensions

C++ Win32

x

x

IContextMenu, IObjectWithSite, IMAPIFolder::DeleteMessages, IMAPIFolder::CopyMessages

Demonstrates how to add items to the menus which are seen while in the message list view within the Inbox (tmail.exe).

Folder : \Common\CPP\Win32\InboxMenuExtensibility

 

Ink2

C++ Win32

x

 

RichInk Control Reference

Demonstrates how to stream rtf and txt formatted data into and out of a RichInk control.

Folder : \PocketPC\CPP\win32\Ink2

 

Inky

C++ Win32

x

 

RichInk Control Reference

Demonstrates the capabilities of the RichInk control.

Folder : \PocketPC\CPP\win32\inky

 

List Views

C++ Win32

x

 

NMLISTVIEW

Demonstrates techniques for using the List-view Control.

Folder : \PocketPC\CPP\win32\ListView

 

Memory Watcher

C++ Win32

x

 

Today Screen

Demonstrates how to create a custom Today screen item for Windows Mobile 6 Professional .

Folder : \PocketPC\CPP\win32\MemWatcher

 

Custom Plug-in Sample

C++Win32

x

 

Today Screen

Demonstrates how to create a custom Today screen item for Windows Mobile 6 Professional .

Folder : PocketPC\cpp\win32\Memwatcher

 

Menu

C++ Win32

x

 

SHCreateMenuBar

Demonstrates how to append, create, and insert sub menu items.

Folder : \PocketPC\CPP\win32\Menu

 

My Backlight

C++ Win32

x

 

CPlApplet

Demonstrates how to create a simple control panel application for a Windows Mobile powered device.

Folder : \PocketPC\CPP\win32\myBackLight

 

Notifications

C++Win32 

x

 

SHNotificationAdd, SHNotificationUpdate, SHNotificationRemove

Demonstrates how to add, update and remove tray notifications.

Folder : \PocketPC\CPP\win32\notifications

 

NotifyMFC

C++ MFC

x

 

SHNotificationAdd, SHNotificationUpdate, SHNotificationRemove

Demonstrates the capabilities and options of the Windows Mobile 6 Professional notifications and alerts API.

Folder : \PocketPC\CPP\MFC\notifyMFC

 

Owner Drawn List-View

C++ Win32

x

x

ListView_GetItem, GDI Reference

Demonstrates how to implement an owner drawn List-view control. Also demonstrates how to use various List-view notification events.

Folder : \Common\CPP\Win32\OwnerListView

 

Project Enumeration

C++ Win32

x

 

File and Application Management, FindWindow, OPENFILENAME, SHMENUBARINFO

Demonstrates the Project document and file manipulation API.

Folder : \PocketPC\CPP\win32\ProjectEnumeration

 

Registry Viewer

C++ Win32

x

 

RegOpenKeyEx, RegQueryInfoKey, RegEnumValue, RegEnumKeyEx

Demonstrates to a Windows Mobile 6 Professional registry viewer application.

Folder : \PocketPC\CPP\win32\Regviewer

 

Resolve Host

C++ Win32

x

 

Winsock Application Development, gethostbyaddr, gethostbyname

Demonstrates how to resolve a host name (e.g. www.microsoft.com) into an IP address, or an IP address into a host name.

Folder : \PocketPC\CPP\win32\Resolve

 

Shell Demo

C++ Win32

x

 

SHInitDialog, SHDoneButton, SHSetNavBarText, SHFullScreen, SHGetAutoRunPath, SHCreateMenuBar, SHEnableSoftkey

Demonstrates the Shell API's. It demonstrates how to show/hide task bars, menu bars, and SIP buttons. It also shows how to use SHInitDialog for full screen dialogs, and use SHCreateMenuBar in different ways.

Folder : \PocketPC\CPP\win32\ShellApiDemo

 

Spin Test

C++ Win32

x

 

Common Controls Reference, CreateWindow

Demonstrates the implementation and use of a custom control (SpinCube).

Folder : \PocketPC\CPP\win32\Spintest

 

Tray Application

C++ Win32

x

 

Shell_NotifyIcon

Demonstrates how to put an icon on the tray on the today page. It also shows how to do a popup dialog from that icon.

Folder : \PocketPC\CPP\win32\Trayapp

 

Tray Task List

C++ Win32

x

 

Shell_NotifyIcon, CreateToolhelp32Snapshot, Process32First, Process32Next

Demonstrates how to get a list of running tasks (and their window names) into a popup item on the tray.

Folder : \PocketPC\CPP\win32\Traytasklist

 

Terminal Emulator

C++ Win32

x

 

CloseHandle, COMMTIMEOUTS, CreateFile, CreateThread, DCB, EscapeCommFunction, GetCommModemStatus, GetCommState, GetCommTimeouts, GetLastError, MessageBox, SetCommMask, SetCommState, WaitCommEvent

Demonstrates how to open, configure, and close a serial communications port and perform read/write operations for a TTY terminal emulation application.

Folder : \PocketPC\CPP\win32\Tty

 

Virtual List-View

C++ Win32

x

x

ListView_SetItemCount, ListView_SetExtendedListViewStyle, ListView_GetExtendedListViewStyle, ListView_SetImageList, ListView_InsertColumn

Demonstrates how to use a virtual list view.

Folder : \Common\CPP\Win32\VirtualListView

 

Capture Back Button Press Events

C++ Win32

 

x

SHCMBM_OVERRIDEKEY, SHNavigateBack

Demonstrates how to detect when the Back Button is pressed on Windows Mobile 6 Standard device, and how you can programmatically interact with it.

Folder : \Smartphone\cpp\Win32\back

 

Close all Child Windows

C++ Win32

 

x

GetWindow, GetWindowThreadProcessId, IsWindowVisible, IsWindowEnabled

Demonstrates how to force an application to revert back to its base state when it is relaunched, and how to destroy a chain of child windows.

Folder: \Smartphone\cpp\Win32\CloseWindow

 

Dvorak Soft Input Panel

C++ ATL

x

 

IInputMethod, ATL, COM

Demonstrates how to create a custom Soft Input Panel (SIP) as a COM object. It is intended to help users and service providers in different regions support different languages in the SIP. The application is a COM component that implements the IInputMethod Interface.

Folder : \PocketPC\CPP\ATL\DvorakSIP

 

Create a Custom Home Screen

C++ Win32

 

x

IHomePlugin, IPersistStream, IHomePluginEnvironment

Requires the installation of the SDKSamplePrivDeveloper certificate.

Folder : \Smartphone\cpp\Win32\HomeScreen

 

Create Soft Key Menus

C++ Win32

 

x

SHCreateMenuBar, SHMENUBARINFO

Demonstrates how to create and manipulate Soft Key menus.

Folder : \Smartphone\cpp\Win32\MenuDemo

 

Create a Custom Input Method

C++ Win32

 

x

SHImeSetCustomInputIcons, SHImeSetModeIcon, SHImeOnKeyPress, SHImeGetClearMessage

Requires the installation of the SDKSamplePrivDeveloper certificate.

Folder : \Smartphone\cpp\Win32\PhoneIme

Setup and Deployment

Multiple CAB Install

C++Win32 

x

x

Setup DLL, Wceload Tool

Demonstrates how to create a program to unpack all the cabs in a container cab ('uber-cab').

Folder : \Common\CPP\Win32\multicabinstall

System Information

State and Notification Broker Viewer

C#

x

x

State and Notifications Broker, Microsft.WindowsMobile.Status Namespace

Demonstrates how to get both state values and state change notifications from the State and Notifications Broker.

Folder : \PocketPC\CS\StateAndNotificationBrokerViewer

Folder : \Smartphone\CS\StateAndNotificationBrokerViewer

 

Battery Status

C++Win32

x

 

RegistryGetDWORD, RegistryNotifyWindow, RegistryNotifyCallback, RegistryNotifyApp

Demonstrates how to use the State and Notification Broker APIs to get notified of the battery strength.

Folder : \PocketPC\CPP\win32\battstat

System Management

Get Device ID

C++ Win32

x

x

GetDeviceUniqueID

Demonstrates how to protect the privacy of a device. Multiple applications need to use a device's unique identifier to communicate with servers. To protect a device's privacy, multiple servers should not be able to correlate data from the same device.

Folder : \Common\CPP\Win32\GetDeviceID

ToolHelp

Process Viewer

C++ Win32

x

x

CreateToolhelp32Snapshot

Demonstrates a process viewer for CE devices.

Folder : \Common\CPP\Win32\PViewCE

Windows

Reversi

C++ Win32

x

 

CheckMenuItem, CreateWindow, DeleteObject, DialogBox, DispatchMessage, Ellipse, EndDialog, EndPaint, ExtTextOut, GetClientRect, GetDC, GetDeviceCaps, GetStockObject, GetSystemMetrics, GetTextExtentExPoint, GetTextMetrics, DefWindowProc, KillTimer, LoadAccelerators, LoadImage, LoadCursor, LocalAlloc, LocalFree, MessageBox, PostMessage, Rectangle, RegisterClass, ReleaseCapture, ReleaseDC, SelectObject, SetBkMode, SetCapture, SetFocus, SetTimer, SetWindowText, ShowWindow, TranslateAccelerator, TranslateMessage

Implements the Reversi game for Windows Mobile 6 Professional . It demonstrates drawing, game logic, and a recursive MiniMax algorithm.

Folder : \PocketPC\CPP\win32\Reversi

 

SliderPuzzle

C#

 

x

System.Drawing, System.Windows.Forms

Demonstrates how to write a Windows Mobile 6 Standard application in C#. The application is a game where the object is to unscramble the tiles. You can only slide the puzzle pieces into the space that is empty.

Folder : \Smartphone\CS\SliderPuzzle

 

WebCrawler

C#

x

x

System.Collections, System.Diagnostics, System.IO, System.Net Namespace, System.Text.RegularExpressions, System.Threading, System.Windows.Forms

Demonstrates how to use managed code to write a C# Windows Mobile application. The application counts the links on a web site, and also counts all of the links that branch from the web site. When done, WebCrawler displays a listing of the results.

Folder : \PocketPC\CS\WebCrawler

 

CompactNav

C#

 

x

List-View Controls Reference, PInvoke

Demonstrates how to implement a basic .NET Compact Framework file-system navigator, as well has how to use "Platform Invoking" (PInvoke) to make calls to unmanaged APIs (in this case, CreateProcess).

Folder : \Smartphone\CS\CompactNav

 

GPS Application

C#

x

 

GPS Intermediate Driver Reference, PInvoke, System.Runtime.InteropServicesSystem.Runtime.InteropServices, System.Threading, System.Windows.Forms

Demonstrates how to use managed code to write a C# Windows Mobile Global Positioning System (GPS) application. This code sample demonstrates how to wrap the native GPS APIs in a C# class. It demonstrates how to use "Platform Invoking" (PInvoke) to make calls to unmanaged APIs (in this case, CreateProcess).

Folder : \PocketPC\CS\GPS

 

Mobile GPS

C++

x

x

GPS_DEVICE, GPS_POSITION, GPSCloseDevice, GPSGetDeviceState, GPSGetPosition, GPSOpenDevice

Demonstrates how to use native GPS Intermediate Driver Reference to asynchronously retrieve the location data and the GPS Intermediate Driver state.

Folder : \Common\CPP\Win32\gps\

 

MUIHello

C++ Win32

 

x

Input Method Manager (IMM) Reference, Multilingual User Interface (MUI) Reference, National Language Support (NLS) Reference

Demonstrates how to write a Multilingual User Interface (MUI) version of a "Hello World!" application.

Folder : \Smartphone\cpp\Win32\muihello

Windows Mobile Ink

Windows Mobile Ink Text Recognition

C++Win32

x

 

Windows Mobile Ink

Demonstrates how to use Windows Mobile Ink to to allows a user to input text with the stylus, and then use Windows Mobile Ink to recognize the text.

Folder : \PocketPC\CPP\win32\WISPLite\BasicRecognition

 

Windows Mobile Ink Notes

C++Win32

x

 

Windows Mobile Ink

Demonstrates how to use Windows Mobile Ink to view and edit ink notes. These ink notes can also be imported to OneNote on the desktop.

Folder : \PocketPC\CPP\win32\WISPLite\InkNotes

 

Windows Mobile Ink Serialization

C++Win32

x

 

Windows Mobile Ink, IInkOverlay, and IInkExtendedProperties

Demonstrates how to use Windows Mobile Ink to allow a user to sign on a region and save the signature along with the user's name in a file.Folder : \PocketPC\CPP\win32\WISPLite\InkSerialization

Windows Media Player

Windows Media Player Application

C++ATL

x

 

Windows Media Player OCX

Demonstrates how to use the Windows Media Player ATL control from a Win32 application.

Folder : \PocketPC\CPP\ATL\WmpSample

 

Windows Media Player Home Plug-in

C++Win32

 

x

IHomePlugin, IPersistStream, IHomePluginEnvironment2, IWMPPluginUI, IWMPEvents

Implements a homescreen plug-in that allows the user to view information about the current media item playing in Windows Media Player, and provides controls to pause or restart playback, to move to the next media item in the current playlist, and to move to the previous media item in the current playlist.

Folder: \Smartphone\CPP\Win32\MediaPlayerHomePlugin

Remarks

You must compile these applications with Visual Studio 2005 or newer.

To setup the Visual Studio environment

  1. Open the solution file in Visual Studio.

  2. Navigate to Tools > Options.

  3. Expand Projects and Solutions.

  4. Click VC++ Directories.

  5. In Show directories for: select Include files.

  6. Add the path to the mobile device include directory. If you accepted the defaults when installing Windows Mobile SDK, then the new directory will be

    C:\Program Files\Windows Mobile 6 SDK\Activesync\Inc

  7. In Show directories for: select Library files.

  8. Add the path to the mobile device library directory. If you accepted the defaults when installing Windows Mobile SDK, then the new directory will be

    C:\Program Files\Windows Mobile 6 SDK\Activesync\Lib

  9. Navigate to Build and click ReBuild All to compile the executable file.

See Also

Other Resources

Programming Techniques for Windows Mobile