what’s new for native code developers in windows mobile marcus perryman microsoft...
Post on 20-Dec-2015
217 views
TRANSCRIPT
What’s New For Native What’s New For Native Code Developers In Code Developers In Windows MobileWindows Mobile
Marcus PerrymanMarcus [email protected]@microsoft.comhttp://blogs.msdn.com/marcpehttp://blogs.msdn.com/marcpe
AgendaAgendaUsing Visual Studio 2005 for C++ Using Visual Studio 2005 for C++ developmentdevelopment
Building your first appBuilding your first appTools and debuggingTools and debuggingMultiple targetsMultiple targets
State Notification BrokerState Notification BrokerEmbedded DatabaseEmbedded DatabasePOOMPOOMDigital Rights ManagementDigital Rights ManagementGlobal Positioning BrokerGlobal Positioning BrokerAPI’s:API’s:
Active Sync, Pictures and Contact, Query Policy, Active Sync, Pictures and Contact, Query Policy, GetDeviceUniqueIDGetDeviceUniqueID
!! Agenda Agenda
What we will not cover, but is still What we will not cover, but is still
interesting to Native developers:interesting to Native developers:
DirectDrawDirectDraw
Direct3DDirect3D
DirectShowDirectShow
Windows Media PlayerWindows Media Player
SQL MobileSQL Mobile
MFC, ATLMFC, ATL
Visual Studio 2005Visual Studio 2005
Single environment for Managed and Single environment for Managed and Native developmentNative development
SDK plug-in modelSDK plug-in model
Device cross-compilersDevice cross-compilers
Remote ToolsRemote Tools
Emulator integrationEmulator integration
Help SystemHelp System
Softkeys For Pocket PCSoftkeys For Pocket PC
SHCreateMenuBarSHCreateMenuBar
SHCMBF_HMENUSHCMBF_HMENURemoves need for command barRemoves need for command bar
2 top level menu’s supported2 top level menu’s supportedSmartphone *ONLY* 2 entriesSmartphone *ONLY* 2 entries
SHEnableSoftkey – enable / disableSHEnableSoftkey – enable / disable
State And State And Notification BrokerNotification Broker
Unified Unified broker model for propagating broker model for propagating system or application events in a system or application events in a publisher / subscriber modelpublisher / subscriber model
Driven through registry keysDriven through registry keys
Transient and Persistent notification Transient and Persistent notification modelmodel
Conditional notificationConditional notification
Extensible modelExtensible model
State Notification CategoriesState Notification Categories> 100 states declared in SNAPI.H> 100 states declared in SNAPI.H
System Wide:System Wide:Network ConnectionsNetwork Connections
WiFi, GPRS, desktop, modemWiFi, GPRS, desktop, modem
MiscMiscDisplay orientation, Cradled, Battery Display orientation, Cradled, Battery
Application:Application:Phone:Phone:
Missed call, Phone status, Caller ID infoMissed call, Phone status, Caller ID info
CalendarCalendarCurrent Appointment, Next AppointmentCurrent Appointment, Next Appointment
MessagingMessagingUnread number of email, SMS, etc.Unread number of email, SMS, etc.
Transient NotificationsTransient Notifications
Notified only when app is runningNotified only when app is running
Notification methodsNotification methodsRegistryNotifyWindowRegistryNotifyWindow
PostMessage for deliveryPostMessage for delivery
RegistryNotifyMsgQueueRegistryNotifyMsgQueueLocal MSMQ messageLocal MSMQ message
RegistryNotifyCallbackRegistryNotifyCallbackDirect callback (background thread)Direct callback (background thread)
Requests do not survive soft resetRequests do not survive soft resetInvalid hWnd removes registrationInvalid hWnd removes registration
Conditional NotificationsConditional Notifications
DWORD conditional operatorsDWORD conditional operators==, !=, >, >=, <, <===, !=, >, >=, <, <=
String conditional operatorsString conditional operators==, !=, >, >=, <, <=, contains, starts with, ==, !=, >, >=, <, <=, contains, starts with, ends withends with
No conditions on binary dataNo conditions on binary data
Persistent NotificationsPersistent Notifications
Application launched if not Application launched if not already runningalready running
RegistryNotifyAppRegistryNotifyApp
Notification methodsNotification methodsCommand lineCommand line
Window MessageWindow Message
Direct registry provisionDirect registry provision[HKEY_LOCAL_MACHINE\System\Notifications[HKEY_LOCAL_MACHINE\System\Notifications\\
MyNotification]MyNotification]
Persists across rebootPersists across reboot
Persistent NotificationPersistent Notification
#include <RegExt.h>#include <RegExt.h>#include <SnApi.h>#include <SnApi.h>
RegistryNotifyApp(SN_POWERBATTERYSTRENGTH_ROOT,RegistryNotifyApp(SN_POWERBATTERYSTRENGTH_ROOT, SN_POWERBATTERYSTRENGTH_PATH,SN_POWERBATTERYSTRENGTH_PATH, SN_POWERBATTERYSTRENGTH_VALUE,SN_POWERBATTERYSTRENGTH_VALUE, L“BatteryChange”, L“BatteryChange”, L“\\Program Files\\My App\\MyApp.exe”,L“\\Program Files\\My App\\MyApp.exe”,
L“MyWindowClass”,L“MyWindowClass”, L“MyWindow”,L“MyWindow”, WM_MYWINDOWMESSAGE,WM_MYWINDOWMESSAGE,
0,0, NULL); NULL);
[HKEY_LOCAL_MACHINE\System\Notifications[HKEY_LOCAL_MACHINE\System\Notifications\MyNotification\MyNotification]]
"HKEY"=dword:0x80000001"HKEY"=dword:0x80000001"Key"="System\\State\\Battery""Key"="System\\State\\Battery""Value Name"="Main" "Value Name"="Main"
"Application"="MyApp.exe param1 param2""Application"="MyApp.exe param1 param2""Class Name"="MyWndClass""Class Name"="MyWndClass""Window Name"="My Window""Window Name"="My Window""Message"=dword:400 "Message"=dword:400 "Flags"=dword:1"Flags"=dword:1
"Conditional Comparison"=dword:5 ; REG_CT_LESS"Conditional Comparison"=dword:5 ; REG_CT_LESS"Conditional Target"=dword:F "Conditional Target"=dword:F
EDBEDB
Replaces CEDBReplaces CEDB
API very similarAPI very similar
CEDB:CEDB: EDB:EDB:
CeMountDBVolCeMountDBVol CeMountDBVolExCeMountDBVolEx
CeCreateDatabaseCeCreateDatabase CeCreateDatabaseWithPropsCeCreateDatabaseWithProps
CEDBASEINFOCEDBASEINFO CEDBASEINFOEXCEDBASEINFOEX
CeOpenDatabaseExCeOpenDatabaseEx CeOpenDatabaseEx2CeOpenDatabaseEx2
CeOidGetInfoExCeOidGetInfoEx CeOidGetInfoEx2CeOidGetInfoEx2
POOMPOOM
Properties:Properties:Add custom propertiesAdd custom properties
Read bulk propertiesRead bulk properties
Change NotificationsChange NotificationsAppointments, Tasks, ContactsAppointments, Tasks, Contacts
Insert, update, delete notificationsInsert, update, delete notifications
PIMPR_FOLDERNOTIFICATIONS folder property
POOM – NotificationsPOOM – Notifications
How to registerHow to register
propval.propid = PIMPR_FOLDERNOTIFICATIONS;
propval.val.ulVal = PIMFOLDERNOTIFICATION_LOCAL | PIMFOLDERNOTIFICATION_REMOTE;
pItemFolder->SetProps(0, 1, &propval);
SDK Sample: CalendarViewSDK Sample: CalendarView
POOM – NotificationsPOOM – NotificationsIPOutlookApp2 *polApp;…polApp->Logon((long)hWnd)
LRESULT CALLBACK WndProc(…) {switch (msg) {
case PIM_ITEM_CREATED_LOCAL:case PIM_ITEM_CREATED_LOCAL:case PIM_ITEM_DELETED_LOCAL:case PIM_ITEM_DELETED_LOCAL:
case PIM_ITEM_CHANGED_LOCAL:case PIM_ITEM_CHANGED_LOCAL: case PIM_ITEM_CREATED_REMOTE:case PIM_ITEM_CREATED_REMOTE: case PIM_ITEM_DELETED_REMOTE:case PIM_ITEM_DELETED_REMOTE: case PIM_ITEM_CHANGED_REMOTE:case PIM_ITEM_CHANGED_REMOTE:
oid = wParam;oid = wParam;olFolder = lParam;olFolder = lParam;
GPS Intermediate DriverGPS Intermediate Driver
Today GPS feed is single clientToday GPS feed is single clientSerial port limitationSerial port limitation
GPS Intermediate:GPS Intermediate:Parses, multiplexes, notifiesParses, multiplexes, notifies
GPSOpenDevice()GPSOpenDevice()
GPSCloseDevice()GPSCloseDevice()
GPSGetPosition()GPSGetPosition()
GPSGetDeviceState()GPSGetDeviceState()
Digital Rights ManagementDigital Rights ManagementFile-based rights protectionFile-based rights protection
Device-lockedDevice-lockedCert specific to deviceCert specific to device
Time or count-bases limitsTime or count-bases limits
Pluggable enginesPluggable enginesFor encryption / decryptionsFor encryption / decryptions
API:API:FileDrmVerifyRights – verify file protectionFileDrmVerifyRights – verify file protection
FileDrmCreateFile – as per CreateFileFileDrmCreateFile – as per CreateFile
FileDrmCommitRights – for count based limitFileDrmCommitRights – for count based limit
Sound SettingsSound Settings
Soundfile.hSoundfile.h
Manage user’s sound settingsManage user’s sound settingsRing tonesRing tones
Global sound settings (PPC Only)Global sound settings (PPC Only)
SndSetSoundSndSetSound
Messaging ApplicationMessaging Application
Drives the UIDrives the UIMailComposeMessageMailComposeMessage
MailDisplayMessageMailDisplayMessage
MailSwitchToFolderMailSwitchToFolder
MailSwitchToAccountMailSwitchToAccount
MailSyncMessagesMailSyncMessages
CeMapi.hCeMapi.h
Image IntegrationImage Integration
New COM object for image load and New COM object for image load and display:display:
IImagingFactory, IImageIImagingFactory, IImage
png, bmp, gif, jpg, ico supportpng, bmp, gif, jpg, ico support
CoCreateInstance (CLSID_ImagingFactory, … IID_IImagingFactory,
…)
pImgFactory->CreateImageFromFile( L"flower.jpg", &pImage);
pImage->Draw(hdc, &rc, NULL);
Image IntegrationImage Integration
Picture Picker:Picture Picker:
Image or Video fileImage or Video file
GetOpenFileNameExGetOpenFileNameEx
Links to camera Links to camera capture dialogcapture dialog
Image IntegrationImage Integration
Camera Capture:Camera Capture:
Image or Video captured Image or Video captured to file of your choiceto file of your choice
SHCameraCaptureSHCameraCapture
For fine control of For fine control of camera stream use camera stream use Direct Show. See Direct Show. See CameraCaptureCameraCapture sample. sample.
Other API’s worthy of noteOther API’s worthy of noteContact PickerContact Picker
ChooseContact(…)ChooseContact(…)
See See AddContactPictureAddContactPicture SDK sample SDK sample
Smartphone IMESmartphone IMECustom input mechanism for SPCustom input mechanism for SP
Query PolicyQuery PolicyNormal code group read only access to device Normal code group read only access to device policy: QueryPolicy(ID, &Out);policy: QueryPolicy(ID, &Out);
GetDeviceUniqueIDGetDeviceUniqueIDNormal code group, application specificNormal code group, application specific
Results are != Device IDResults are != Device ID
GetDeviceUniqueID(…)GetDeviceUniqueID(…)
Tools & ResourcesTools & Resources
msdn.microsoft.com/msdn.microsoft.com/ embeddedembedded
microsoft.public.microsoft.public. windowsxp.embeddedwindowsxp.embedded windowsce.platbuilderwindowsce.platbuilder windowsce.embedded.vcwindowsce.embedded.vc
blogs.msdn.com/blogs.msdn.com/ mikehallmikehall
Windows CE 5.0 Eval KitWindows CE 5.0 Eval KitWindows XP Embedded Eval KitWindows XP Embedded Eval Kit
msdn.microsoft.com/msdn.microsoft.com/ mobilitymobility
microsoft.public.microsoft.public. pocketpc.developer pocketpc.developer smartphone.developer smartphone.developer dotnet.framework.compactframeworkdotnet.framework.compactframework
blogs.msdn.com/blogs.msdn.com/ windowsmobilewindowsmobile vsdteamvsdteam netcfteamnetcfteam
Windows Mobile 5.0 Eval KitWindows Mobile 5.0 Eval Kit
WebsitesWebsites
NewsgroupsNewsgroups
BlogsBlogs
ToolsTools
BuildBuild DevelopDevelop