330 likes | 483 Views
What’s New For Native Code Developers In Windows Mobile. Marcus Perryman Microsoft marcpe@microsoft.com http://blogs.msdn.com/marcpe. Agenda. Using Visual Studio 2005 for C++ development Building your first app Tools and debugging Multiple targets State Notification Broker
E N D
What’s New For Native Code Developers In Windows Mobile Marcus Perryman Microsoft marcpe@microsoft.com http://blogs.msdn.com/marcpe
Agenda • Using Visual Studio 2005 for C++ development • Building your first app • Tools and debugging • Multiple targets • State Notification Broker • Embedded Database • POOM • Digital Rights Management • Global Positioning Broker • API’s: • Active Sync, Pictures and Contact, Query Policy, GetDeviceUniqueID
! Agenda What we will not cover, but is still interesting to Native developers: • DirectDraw • Direct3D • DirectShow • Windows Media Player • SQL Mobile • MFC, ATL
Visual Studio 2005 • Single environment for Managed and Native development • SDK plug-in model • Device cross-compilers • Remote Tools • Emulator integration • Help System
Softkeys For Pocket PC • SHCreateMenuBar • SHCMBF_HMENU • Removes need for command bar • 2 top level menu’s supported • Smartphone *ONLY* 2 entries • SHEnableSoftkey – enable / disable
State And Notification Broker • Unified broker model for propagating system or application events in a publisher / subscriber model • Driven through registry keys • Transient and Persistent notification model • Conditional notification • Extensible model
State Notification Categories • > 100 states declared in SNAPI.H • System Wide: • Network Connections • WiFi, GPRS, desktop, modem • Misc • Display orientation, Cradled, Battery • Application: • Phone: • Missed call, Phone status, Caller ID info • Calendar • Current Appointment, Next Appointment • Messaging • Unread number of email, SMS, etc.
Transient Notifications • Notified only when app is running • Notification methods • RegistryNotifyWindow • PostMessage for delivery • RegistryNotifyMsgQueue • Local MSMQ message • RegistryNotifyCallback • Direct callback (background thread) • Requests do not survive soft reset • Invalid hWnd removes registration
Conditional Notifications • DWORD conditional operators • ==, !=, >, >=, <, <= • String conditional operators • ==, !=, >, >=, <, <=, contains, starts with, ends with • No conditions on binary data
Persistent Notifications • Application launched if not already running • RegistryNotifyApp • Notification methods • Command line • Window Message • Direct registry provision [HKEY_LOCAL_MACHINE\System\Notifications\MyNotification] • Persists across reboot
Persistent Notification • [HKEY_LOCAL_MACHINE\System\Notifications\MyNotification] • "HKEY"=dword:0x80000001 • "Key"="System\\State\\Battery" • "Value Name"="Main" • "Application"="MyApp.exe param1 param2" • "Class Name"="MyWndClass" • "Window Name"="My Window" • "Message"=dword:400 • "Flags"=dword:1 • "Conditional Comparison"=dword:5 ; REG_CT_LESS • "Conditional Target"=dword:F #include <RegExt.h> #include <SnApi.h> RegistryNotifyApp(SN_POWERBATTERYSTRENGTH_ROOT, SN_POWERBATTERYSTRENGTH_PATH, SN_POWERBATTERYSTRENGTH_VALUE, L“BatteryChange”, L“\\Program Files\\My App\\MyApp.exe”, L“MyWindowClass”, L“MyWindow”, WM_MYWINDOWMESSAGE, 0, NULL);
EDB • Replaces CEDB • API very similar
POOM • Properties: • Add custom properties • Read bulk properties • Change Notifications • Appointments, Tasks, Contacts • Insert, update, delete notifications • PIMPR_FOLDERNOTIFICATIONS folder property
POOM – Notifications • How to register propval.propid = PIMPR_FOLDERNOTIFICATIONS; propval.val.ulVal = PIMFOLDERNOTIFICATION_LOCAL | PIMFOLDERNOTIFICATION_REMOTE; pItemFolder->SetProps(0, 1, &propval); SDK Sample: CalendarView
POOM – Notifications IPOutlookApp2 *polApp; … polApp->Logon((long)hWnd) LRESULT CALLBACK WndProc(…) { switch (msg) { case PIM_ITEM_CREATED_LOCAL: case PIM_ITEM_DELETED_LOCAL: case PIM_ITEM_CHANGED_LOCAL: case PIM_ITEM_CREATED_REMOTE: case PIM_ITEM_DELETED_REMOTE: case PIM_ITEM_CHANGED_REMOTE: oid = wParam; olFolder = lParam;
GPS Intermediate Driver • Today GPS feed is single client • Serial port limitation • GPS Intermediate: • Parses, multiplexes, notifies • GPSOpenDevice() • GPSCloseDevice() • GPSGetPosition() • GPSGetDeviceState()
Digital Rights Management • File-based rights protection • Device-locked • Cert specific to device • Time or count-bases limits • Pluggable engines • For encryption / decryptions • API: • FileDrmVerifyRights – verify file protection • FileDrmCreateFile – as per CreateFile • FileDrmCommitRights – for count based limit
Sound Settings • Soundfile.h • Manage user’s sound settings • Ring tones • Global sound settings (PPC Only) • SndSetSound
Messaging Application • Drives the UI • MailComposeMessage • MailDisplayMessage • MailSwitchToFolder • MailSwitchToAccount • MailSyncMessages • CeMapi.h
Image Integration • New COM object for image load and display: • IImagingFactory, IImage • png, bmp, gif, jpg, ico support CoCreateInstance (CLSID_ImagingFactory, … IID_IImagingFactory,…) pImgFactory->CreateImageFromFile( L"flower.jpg", &pImage); pImage->Draw(hdc, &rc, NULL);
Image Integration • Picture Picker: • Image or Video file • GetOpenFileNameEx • Links to camera capture dialog
Image Integration • Camera Capture: • Image or Video captured to file of your choice • SHCameraCapture • For fine control of camera stream use Direct Show. See CameraCapture sample.
Other API’s worthy of note • Contact Picker • ChooseContact(…) • See AddContactPicture SDK sample • Smartphone IME • Custom input mechanism for SP • Query Policy • Normal code group read only access to device policy: QueryPolicy(ID, &Out); • GetDeviceUniqueID • Normal code group, application specific • Results are != Device ID • GetDeviceUniqueID(…)
Tools & Resources Build Develop Websites msdn.microsoft.com/embedded msdn.microsoft.com/mobility Newsgroups microsoft.public.pocketpc.developer smartphone.developer dotnet.framework.compactframework microsoft.public.windowsxp.embedded windowsce.platbuilder windowsce.embedded.vc Blogs blogs.msdn.com/windowsmobilevsdteamnetcfteam blogs.msdn.com/mikehall Tools Windows CE 5.0 Eval KitWindows XP Embedded Eval Kit Windows Mobile 5.0 Eval Kit
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.