Share via


Code Samples

Send Feedback

The Windows Mobile Version 5.0 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 5.0 platform. To use them, you need Visual Studio 2005, either the Windows Mobile Version 5.0 Pocket PC SDK or the Windows Mobile Version 5.0 Smartphone SDK, and ActiveSync Version 4.1. For more information on these and other Windows Mobile development tools, visit the Mobile Developer Center on MSDN.

The code samples are installed onto your workstation when you install the Pocket PC and Smartphone SDKs. Each SDK ships with code samples that are common to both platforms, as well as specific to each platform.

By default, the Pocket PC code samples are copied to the folder

   C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\

By default, the Smartphone code samples are copied to the folder

   C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Smartphone SDK\Samples\

Note   The majority of the code samples are C++ Win32 applications, and you will find them inside 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.

The following table contains a detailed listing of the code samples included with the Windows Mobile 5.0 Pocket PC and Smartphone SDKs.

Feature Area Code Sample Topic Language PPC SP 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: \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: \Cameracapture

  Camera C++ Win32, C# x x SHCameraCapture, CameraCaptureDialog Class Take pictures and videos using the native Camera Capture API.

Folder: \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: \Cellcore\CeDialer

  Synchronous TAPI C++ Win32 x x lineNegotiateAPIVersion, lineGetDevCaps, lineGetGeneralInfo, lineInitializeEx, lineOpen, lineClose, lineShutdown Demonstrates ExTAPI functionality.

Folder: \Cellcore\Extapi

  Asychronous TAPI C++ Win32 x x lineNegotiateAPIVersion, lineGetDevCaps, lineGetGeneralInfo, LINEINITIALIZEEXPARAMS, lineNegotiateExtVersion, lineGetOperatorStatus, lineOpen, lineClose, lineShutdown Demonstrates ExTAPI asynchronous functionality.

Folder: \Cellcore\Extapiasync

  Hello (SMS) C++ Win32 x x SmsSendMessage Demonstrates simple SMS message Sender.

Folder: \Cellcore\Sms\HelloSMS

  Hello (Telephone) C++ Win32 x x tapiRequestMakeCall Demonstrates simple TAPI dialer.

Folder: \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: \Cellcore\Wdp_sms

Communications Bluetooth Device Discovery C++ Win32 x   Bluetooth, Winsock Support in Windows CE, WSALookupServiceBegin (Windows Sockets), WSALookupServiceNext (Windows Sockets), WSALookupServiceEnd (Windows Sockets) Provides an implementation of simple Bluetooth device discovery via the Winsock 2 API.

Folder: \Bluetooth\btsearch

  Chatting over Bluetooth C++ Win32 x   Bluetooth Demonstrates how to create peer-to-peer communications between two devices using Bluetooth wireless technology.

Folder: \Bluetooth\Bthchat

  Bluetooth Event Notifications C++ Win32 x   Changing the Bluetooth Radio Mode, State and Notifications Broker Demonstrates how to get notifications from the Bluetooth stack. It also shows the use of State and Notifications Broker functions to receive notifications about radio state changes.

Folder: \Bluetooth\BluetoothEvents

  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: \CMHELPER

  Time Server Synchronization C++ Win32   x ConnMgrReleaseConnection, ConnMgrEnumDestinations, ConnMgrEstablishConnection Demonstrates how to use Connection Managermob5oriConnectionManagerWindowsMobile to establish a connection to a Time Server, and synchronize the Smartphone's internal clock.

Folder: \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: \Cellcore

Device
Configuration
WAP Provisioning Client C++ Win32   x DMProcessConfigXML Loads WAP provisioning XML from a string resource and passes it to DMProcessConfigXML.

Folder: \Cfgclient

  Setup in a CAB C++ Win32 x x Installation FunctionsCustomizing the Setup Wizard and Property Sheets for a Thin Client, Debugging Setup, CreateProcess Demonstrates a user-interactive sample of a setup.dll that can be included in CAB files to perform complex operations.

Folder: \Setupdll

  Viewing Security Settings C# x x ProcessConfiguration, TestConfiguration Demonstrates how work with security policies and certificates.

Folder: \Securityviewer

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: \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: \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: \Directx\d3dm\tutorials\Tut03_matrices

  D3D Dynamic Lighting C++ Win32 x   Direct3D Mobile Application Development, D3DMLIGHT, D3DM_SETLIGHT, IDirect3DMobileDevice::LightEnable Demonstrates how to render 3D geometry with dynamic lighting.

Folder: \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: \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: \Directx\d3dm\tutorials\Tut06_fixedpoint

Direct Draw DDraw Initialization C++ Win32 x   DirectDraw Demonstrates how to initialize DirectDraw and create a DirectDraw surface.

Folder: \Directx\Ddraw\DDex1

  DDraw and Bitmaps C++ Win32 x   DirectDraw Demonstrates how to add a bitmap. Extends DDex1.

Folder: \Directx\Ddraw\Ddex2

  DDraw Off-Screen Surfaces C++ Win32 x   DirectDraw Demonstrates the use of off-screen surfaces.

Folder: \Directx\Ddraw\Ddex3

  DDraw and Audio C++ Win32 x   DirectDraw Demonstrates how to combine DirectDraw and waveform audio.

Folder: \Directx\Ddraw\Donuts2

  DDraw and Animation C++ Win32 x   DirectDraw Demonstrates DirectDraw animation using overlays.

Folder: \Directx\Ddraw\Mosquito

FileDRM DRM Files C++ Win32 x x FileDrmIsDRM, FileDrmShowLicenseInfo, FileDrmVerifyRights, FileDrmCreateFile, FileDrmGetMetric, FileDrmCommitRights Demonstrates how to use the FileDRM APIs.

Folder: \Filedrm\FileDRM

GAPI GAPI Application C++ Win32 x x GAPI Overview Game API sample.

Folder: \Gapiapp

Imaging Imaging C++ Win32 x x IImage, IImagingFactory Demonstrates how to use the imaging.dll to load and display an image file.

Folder: \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: \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: \Browse

  The Browser Helper Object (BHO) C++ ATL x x IWebBrowser2, DWebBrowserEvents2 Demonstrates now to create a Browser Helper Object (BHO), which Internet Explorer (IE) Mobile loads each time it starts up.

Folder: \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: \Minipie

Menu extensions, POOM Named Properties Medical History C++ Win32 x   IItem::SetProps, IPOutlookApp2::GetIDsFromNames, IPOutlookApp2 (IPOutlookApp::Logon, IPOutlookApp2::GetItemFromOidEx), IItem (IItem::GetProps, IItem::Save), Menu Extensibility, IContextMenu, IObjectWithSite Demonstrates how to add a menu extension to the contacts summary card.

Folder: \Medicalhistory\MedicalHistory

Message Queuing Message Queuing 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: \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: \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: \Mailset\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: \Mapirule

  Read View Menu Extension C++ Win32 x x Menu Extensibility, IContextMenu, IObjectWithSite, MailComposeMessage Demonstrates how to reply to an email message using a default email account.

Folder: \Readviewmenuext\ReadViewMenuExt

  Sending E-mail C++ Win32 x x Messaging API (MAPI), MAPILogonEx, SRowSet, IMAPISession::GetMsgStoresTable, IMAPISession::OpenMsgStore, IMAPITable::QueryRows, IMsgStore::OpenEntry, IMAPIProp::GetProps, IMAPIFolder::CreateMessage, IMessage::SubmitMessage, MAPIFreeBuffer, FreeProws Demonstrates how to use several CEMAPI APIs.

Folder: \Sendmail

  New Messaging Transport C++ Win32 x   IMailSyncHandler Demonstrates how to create a new messaging transport.

Folder: \Transportdemo

  New Message Class C++ Win32 x   IFormProviderEx, IMailRuleClient Implements a new message class appropriate for SMS notifications from your DVR.

Folder: \Tv_inbox\TVCustomForm

Phone Calling Card C++ Win32   x IContextMenu::QueryContextMenu Demonstrates how to make a calling card call directly from the Contacts screen.

Folder: \Callingcard

  Get Device's Phone Number C++ Win32 x x IWebBrowser2, DWebBrowserEvents2 Demonstrates how to retrieve the phone number of a device.

Folder: \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: \PhoneFinder

  Manage SIM Contacts C++ Win32   x SIM Manager, SimDeinitialize, SimGetDevCaps, SimInitialize, SimReadPhonebookEntry, Telephony Demonstrates how to add phone numbers to, and delete phone numbers from, a Subscriber Identity Module (SIM).

Folder: \Simmgr

POOM Calendar List View C++ Win32 x   CEPROPVAL, GetCursor, IDispatch, IFolder, IItem, InitCommonControlsEx, INITCOMMONCONTROLSEX, 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: \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: \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: \Pimexprovider

  POOM Master C++ Win32 x x Pocket Outlook Object Model (POOM), IPOutlookApp, IPOutlookItemCollection, ITask, IContact, IAppointment, ListView_InsertItem, Date and Time Picker Controls 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: \Poommaster

  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: \Pocketoutlooksample

  Add Contacts' Birthdays to Calendar C# x x Microsoft.WindowsMobile.PocketOutlook, Microsoft.WindowsMobile.PocketOutlook.Appointment, Appointment.RecurrencePattern, Recurrence Demonstrates how to write a managed Pocket Outlook Object Model (POOM) application.

Folder: \Birthdaystocalendar

  Send Meeting Requests Over SMS C# x   Pocket Outlook Object Model (POOM), Pocket Outlook Object Model (POOM) API, 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: \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: \CS\Smsim

  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: \Poomtasks

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: \AddContactPicture

POOM,
Custom Properties
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: \Tasktree

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: \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: \Powermanager

RAPI CE Invoke C++ Win32 x   CeRapiInvoke Demonstrates how to use the CEInvoke API for the client, and for the server.

Folder: \Ceinvoke

  Get Device Information C++ Win32 x x EnumDevicesIRAPIDesktop:IUnknown, IRAPIDevice::GetConnectionInfo, IRAPIDevice::GetDeviceInfo, IRAPIDevice:IUnknown, Remote API (RAPI) Demonstrates how to use the IRAPI interfaces to get information about the Windows Mobile-based device connected through ActiveSync and the corresponding communication medium used. Once the information is collected, it is printed on the console window.

Folder: \Deviceinfo

  List a Directory and its Files C++ Win32 x x CeRapiInit, CeFindFirstFile, CeFindNextFile, CeFindClose, CeRapiUninit This application runs on a desktop host computer, and demonstrates how to list a directory's files and directories on a Mobile device.

Folder: \Rapi\Pdir

  Copy a File from a Device C++ Win32 x x CeRapiInit, CeReadFile, CeCloseHandle, CeRapiUninit This application runs on a desktop host computer, and demonstrates how to copy a file from a Mobile device to a desktop computer.

Folder: \Rapi\Pget

  Copy a File to a Device C++ Win32 x x CeRapiInit, CeWriteFile, CeCloseHandle, CeRapiUninit This application runs on a desktop host computer, and demonstrates how to copy a file from the desktop computer to a Mobile device.

Folder: \Rapi\Pput

  Retrieve Registry Settings C++ Win32 x x CeRapiInit, CeRegEnumKeyEx, CeRegOpenKeyEx, CeRegEnumValue, CeRegCloseKey, CeRapiUninit This application runs on a desktop host computer, and demonstrates how to retrieve a Mobile device's list of registry settings.

Folder: \Rapi\Pregdmp

  Execute an Application on a Device C++ Win32 x x CeRapiInit, CeCreateProcess, CeCloseHandle, CeRapiUninit This application runs on a desktop host computer, and demonstrates how to execute an executable file on a Mobile device.

Folder: \Rapi\Prun

  List all Directories and their Files C++ Win32 x x CeRapiInit, CeFindAllFiles, CeRapiFreeBuffer, CeRapiUninit This application runs on a desktop host computer, and demonstrates how to list all of the files and directories on a Mobile device.

Folder: \Rapi\Ptree

  Communication with Sockets C++ Win32 x x EnumDevices, IRAPIDesktop:IUnknown, IRAPIDevice::GetConnectionInfo, IRAPIDevice:IUnknown Demonstrates how to use sockets to communicate with a Windows Mobile-based device. At first hand, the application uses IRAPI interfaces to get the IP of the Windows Mobile connected through ActiveSync. In a second step, it sends a hello string and listen for the mobile device to respond back

Folder: \Sockapp

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: \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 the Windows Mobile OS.

Folder: \Basicapp

  Calendar and DTP Controls C++ Win32 x   Date and Time Picker Controls Demonstrates how to use the Calendar and DTP controls.

Folder: \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: \Ctxmenu

  Currency Converter C++ Win32   x CreateMutex, SHCreateMenuBar, SetFocus Demonstrates how to port an application written for Pocket PC, and port it to Smartphone.

Folder: \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: \Dirtree

  Dynamic Menu C++ Win32 x   SHGetSubMenu, SHSetSubMenu, CheckMenuRadioItem, CheckMenuItem, InsertMenu, DeleteMenu Demonstrates techniques for using, getting, and setting menu handles on Pocket PC.

Folder: \Dynamenu

  File Change Notification C++ Win32 x   SHChangeNotifyRegister, SHChangeNotifyDeregister Demonstrates how to listen for changes to the file system.

Folder: \Filechangenotif

  SIP Handles C++ Win32 x   SipGetInfo, Common Controls, Software-Based Input Panel Demonstrates how to use SIP functions.

Folder: \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: \Htmlhost

  Hardware Navigation C++ Win32 x   WM_GETDLGCODE Demonstrates how focus moves around a dialog when the user performs various hardware navigation actions.

Folder: \Hwnavigation

  Inbox Menu Extensions C++ Win32 x x Menu Extensibility, 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: \Inboxmenuextensibility\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: \Ink2

  Inky C++ Win32 x   RichInk Control Reference Demonstrates the capabilities of the RichInk control.

Folder: \Inky

  List Views C++ Win32 x   ListView_Update Demonstrates techniques for using the List-view Control.

Folder: \Listview

  Memory Watcher C++ Win32 x   Today Screen Demonstrates how to create a custom Today screen item for Pocket PC.

Folder: \Memwatcher

  Menu C++ Win32 x   Menu Extensibility Demonstrates how to append, create, and insert sub menu items.

Folder: \Menu

  My Backlight C++ Win32 x   CPlApplet Demonstrates how to create a simple control panel application for a Windows Mobile-based Pocket PC device.

Folder: \Mybacklight

  NotifyMFC C++ MFC x   SHNotificationAdd, SHNotificationUpdate, SHNotificationRemove Demonstrates the capabilities and options of the Pocket PC notifications and alerts API.

Folder: \Notifymfc

  Owner Drawn List-View C++ Win32 x x ListView_GetItem, Win32 Classes, GDI Reference Demonstrates how to implement an owner drawn List-view control. Also demonstrates how to use various List-view notification events.

Folder: \Ownerlistview

  Project Enumeration C++ Win32 x   File and Application Management API, FindWindow LoadAccelerators, OPENFILENAME, SHMENUBARINFO Demonstrates the Project document and file manipulation API.

Folder: \Projectenumeration

  Registry Viewer C++ Win32 x   RegOpenKeyEx, RegQueryInfoKey, RegEnumValue, RegEnumKeyEx Demonstrates to a Pocket PC registry viewer application.

Folder: \Regviewer

  Screen Resolution C++ Win32 x     As you are developing applications for new high-resolution Pocket PCs 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: \Resdll

  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: \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: \Shellapidemo

  Spin Test C++ Win32 x   Common Controls, CreateWindow Demonstrates the implementation and use of a custom control (SpinCube).

Folder: \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: \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: \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: \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: \Virtuallistview

  Capture Back Button Press Events C++ Win32   x SHCMBM_OVERRIDEKEY, SHNavigateBack Demonstrates how to detect when the Back Button is pressed on Smartphone, and how you can programmatically interact with it.

Folder: \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: \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 foreign countries support different languages in the SIP. The application is a COM component that implements the IInputMethod Interface.

Folder: \Dvoraksip

  Create a Custom Home Screen C++ Win32   x IHomePlugin, IPersistStream:IPersist, IHomePluginEnvironment Requires the installation of the SDKSamplePrivDeveloper certificate.

Folder: \Homescreen

  Create Soft Key Menus C++ Win32   x AYGShell, SHCreateMenuBar, SHMENUBARINFO Demonstrates how to create and manipulate Soft Key menus.

Folder: \Menudemo

  Create a Custom Input Method C++ Win32   x SHImeSetCustomInputIcons, SHImeSetModeIcon, SHImeOnKeyPress, SHImeGetClearMessage Requires the installation of the SDKSamplePrivDeveloper certificate.

Folder: \Phoneime

System
Information
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: \Crossword

  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: \CS\Stateandnotificationbrokerviewer

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: \Getdeviceid\GetDeviceID

ToolHelp Process Viewer C++ Win32 x x CreateToolhelp32Snapshot Demonstrates a process viewer for CE devices.

Folder: \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 Demonstrates how to implement the Reversi game for Pocket PC. It demonstrates drawing, game logic, and a recursive MiniMax algorithm.

Folder: \Reversi

  SliderPuzzle C#   x System.Drawing Namespace, System.Windows.Forms Namespace Demonstrates how to write a Smartphone 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: \CS\Sliderpuzzle

  WebCrawler C# x x System.Collections Namespace, System.Diagnostics Namespace, System.IO Namespace, System.Net Namespace, System.Text.RegularExpressions Namespace, System.Threading Namespace, System.Windows.Forms Namespace 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: \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: \CS\Compactnav

  GPS C# x x GPS Intermediate Driver Reference, PInvoke, System.Runtime.InteropServices, System.Threading Namespace, System.Windows.Forms Namespace 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: \CS\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: \Muihello

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 CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Activesync\Inc for Pocket PC, or

    C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Smartphone SDK\Activesync\Inc for Smartphone.

  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 CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Activesync\Lib for Pocket PC, or

    C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Smartphone SDK\Activesync\Lib for Smartphone.

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

See Also

Developer's Reference

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.