View
222
Download
0
Embed Size (px)
Citation preview
Microsoft Smartphone Microsoft Smartphone 2002 Development2002 Development
Chung WebsterChung Webster
ConsultantConsultant
Microsoft Developer ServicesMicrosoft Developer Services
AgendaAgenda
Smartphone HardwareSmartphone Hardware Smartphone OSSmartphone OS Smartphone User InterfaceSmartphone User Interface Development ToolsDevelopment Tools Application Security & DeploymentApplication Security & Deployment Working with TelephonyWorking with Telephony .NET Compact Framework.NET Compact Framework
Smartphone 2002 Smartphone 2002 HardwareHardware 120MHz ARM processor120MHz ARM processor
16MB RAM for application 16MB RAM for application execution and temporary execution and temporary storagestorage
32MB flash ROM for OS and 32MB flash ROM for OS and permanent data storagepermanent data storage
176x220 16-bit colour display176x220 16-bit colour display
Storage and MemoryStorage and Memory
ROM (~24MB)ROM (~24MB) Permanent content from Microsoft, OEM, and Permanent content from Microsoft, OEM, and
Operator provided applications.Operator provided applications. Can be updated over-the-air.Can be updated over-the-air.
Flash (~8MB)Flash (~8MB) Permanent data storage for application data, Permanent data storage for application data,
registry, and files, and databases.registry, and files, and databases. Survives power loss, reboots, etc.Survives power loss, reboots, etc.
RAM (~16MB)RAM (~16MB) Application execution and radio.Application execution and radio. Cleared on power off and reboot.Cleared on power off and reboot.
Smartphone 2002 OSSmartphone 2002 OS
LogicConnectionManager
ToolkitSyncEngine
TAPI SIM WAP SMSCore APIs
GSM SIMRadio Stack CDMA
Apps / UI DiallerControlPanel
HomeScreen
Inbox
Threading Networking Winsock CryptoAPICE 3.0
Not S
upp
orte
d
Not Recommended
New Controls
Sup
porte
d
WinCE ControlsWinCE Controls
CheckBoxCheckBox DatePickerDatePicker EditEdit HeaderHeader ListboxListbox ListviewListview ProgressProgress ScrollbarScrollbar StaticStatic StatusStatus TrackbarTrackbar TreeviewTreeview
ButtonsButtons Radio ButtonsRadio Buttons
Combo boxCombo box Month CalendarMonth Calendar Property Property
Sheets/PagesSheets/Pages ToolbarToolbar
Expandable EditExpandable Edit Multi-Item PickerMulti-Item Picker
Smartphone User Smartphone User InterfaceInterface Form factor require control changesForm factor require control changes
MenusMenus Multiline Text EditMultiline Text Edit ListboxesListboxes Stylus / SIP InputStylus / SIP Input
SoftkeysSoftkeys
Expandable EditExpandable Edit
SpinnersSpinners
Input ModesInput Modes
SoftkeysSoftkeys
Left softkey is most common actionLeft softkey is most common action Right softkey is a menuRight softkey is a menu
Items are listed in desktop-style orderItems are listed in desktop-style order Items never have ellipses (…)Items never have ellipses (…)
Dialogs have “Done” on the left softkey Dialogs have “Done” on the left softkey and “Cancel” on the right (if necessary)and “Cancel” on the right (if necessary)
Edit ControlsEdit Controls
Edit controls support multiple input Edit controls support multiple input methodsmethods Typically the methods available will be numeric, Typically the methods available will be numeric,
multi-tap, and T9multi-tap, and T9
Multi-line edit controls support zooming in Multi-line edit controls support zooming in for a larger viewfor a larger view
Spinner ControlSpinner Control
Replaces combo boxes, radio Replaces combo boxes, radio buttons, and list boxesbuttons, and list boxes
Multi-item selection availableMulti-item selection available
Typical Application FlowTypical Application Flow
List view -> card view -> edit viewList view -> card view -> edit view Contacts is a classic exampleContacts is a classic example
Development ToolsDevelopment Tools
eMbedded Visual C++ 3.0eMbedded Visual C++ 3.0 Smartphone 2002 SDKSmartphone 2002 SDK EmulatorEmulator No MFC / ATLNo MFC / ATL No eVBNo eVB Remote ToolsRemote Tools
Registry ViewerRegistry Viewer Process ViewerProcess Viewer File ViewerFile Viewer
Useful Code SamplesUseful Code Samples
Finding the Persistent Storage Finding the Persistent Storage PathPath To persist data, it must be stored in the To persist data, it must be stored in the
registry or under in persistent storage registry or under in persistent storage directorydirectory
Use SHGetSpecialFolderPath() for root pathUse SHGetSpecialFolderPath() for root path CSIDL_APPDATA\<appname> for files internal to CSIDL_APPDATA\<appname> for files internal to
your appyour app CSIDL_PERSONAL for files the user needs to work CSIDL_PERSONAL for files the user needs to work
with (“My Documents”)with (“My Documents”)
Data stored in RAM file system will be lost Data stored in RAM file system will be lost on power offon power off
Finding the Persistent Storage Finding the Persistent Storage PathPath
TCHAR szVolumeFile[MAX_PATH];TCHAR szVolumeFile[MAX_PATH];
if(!SHGetSpecialFolderPath(NULL, szVolumeFile, if(!SHGetSpecialFolderPath(NULL, szVolumeFile, CSIDL_APPDATA, TRUE))CSIDL_APPDATA, TRUE))
{{ASSERT(FALSE);ASSERT(FALSE);
hr = HRESULT_FROM_WIN32(GetLastError());hr = HRESULT_FROM_WIN32(GetLastError());
return 0;return 0;
}}
// szVolumeFile - \IPSM\Application Data// szVolumeFile - \IPSM\Application Data
Creating Softkeys and Handling Creating Softkeys and Handling BackBack
Softkeys are just PocketPC menu Softkeys are just PocketPC menu bars that only have two itemsbars that only have two items
Send a message to the menu bar to Send a message to the menu bar to request messages for the back keyrequest messages for the back key
Creating Softkeys and Handling Creating Softkeys and Handling BackBack#define TPC#define TPC
//Create a MenuBar//Create a MenuBarSHMENUBARINFO mbi;SHMENUBARINFO mbi;memset(&mbi, 0, sizeof(SHMENUBARINFO));memset(&mbi, 0, sizeof(SHMENUBARINFO));mbi.cbSize = sizeof(SHMENUBARINFO);mbi.cbSize = sizeof(SHMENUBARINFO);mbi.hwndParent = hParent;mbi.hwndParent = hParent;mbi.nToolBarId = IDM_MAIN_MENU;mbi.nToolBarId = IDM_MAIN_MENU;mbi.hInstRes = g_hInst;mbi.hInstRes = g_hInst;mbi.nBmpId = 0;mbi.nBmpId = 0;mbi.cBmpImages = 0;mbi.cBmpImages = 0;
// Create the menu bar// Create the menu barif (!SHCreateMenuBar(&mbi))if (!SHCreateMenuBar(&mbi)){{
MessageBox(hParent, TEXT("SHCreateMenuBar Failed"), MessageBox(hParent, TEXT("SHCreateMenuBar Failed"), TEXT("Error"), MB_OK);TEXT("Error"), MB_OK);return false;return false;
}}
Creating Softkeys and Handling BackCreating Softkeys and Handling Back
// Request notifications for the back key// Request notifications for the back keySendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK,
MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT | SHMBOF_NOTIFY));| SHMBOF_NOTIFY));
Creating Softkeys and Handling Creating Softkeys and Handling BackBack// Handle the back key in the main window proc// Handle the back key in the main window procLRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMessage, WPARAM LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMessage, WPARAM
wParam, LPARAM lParam)wParam, LPARAM lParam){{
switch (uMessage)switch (uMessage){{
……case WM_HOTKEY:case WM_HOTKEY:{{if((VK_TBACK == HIWORD(lParam))if((VK_TBACK == HIWORD(lParam)) {{ // Send back key to control with focus// Send back key to control with focus SHSendBackToFocusWindow(message, wParam, lParam);SHSendBackToFocusWindow(message, wParam, lParam); }}}}
}}}}
Voice Calls ExampleVoice Calls Example
#include <phone.h>#include <phone.h>
PHONEMAKECALLINFO mci;PHONEMAKECALLINFO mci;int result;int result;
memset(&mci, 0, sizeof(mci));memset(&mci, 0, sizeof(mci));mci.cbSize = sizeof(mci);mci.cbSize = sizeof(mci);mci.dwFlags = PMCF_PROMPTBEFORECALLING;mci.dwFlags = PMCF_PROMPTBEFORECALLING;mci.pszDestAddress = TEXT(“+18005551212");mci.pszDestAddress = TEXT(“+18005551212");
result = PhoneMakeCall(mci);result = PhoneMakeCall(mci);if (result != 0)if (result != 0){{ // Insert error handling code here// Insert error handling code here}}
Changing Input ModesChanging Input Modes
//Set input mode to multitap //Set input mode to multitap SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0,
EIM_SPELL);EIM_SPELL);
//Set input mode to numeric//Set input mode to numericSendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0,
EIM_NUMBERS);EIM_NUMBERS);
//Set input mode to T9//Set input mode to T9SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0,
EIM_AMBIG);EIM_AMBIG);
//Set input mode to multitap //Set input mode to multitap SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0,
EIM_SPELL);EIM_SPELL);
//Set input mode to numeric//Set input mode to numericSendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0,
EIM_NUMBERS);EIM_NUMBERS);
//Set input mode to T9//Set input mode to T9SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0, SendDlgItemMessage(hDlg, IDC_CONTROL, EM_SETINPUTMODE, 0,
EIM_AMBIG);EIM_AMBIG);
Dialler AppDialler App
Introduction to TelephonyIntroduction to Telephony
Application Security and Application Security and DeploymentDeployment
Locked device 2Locked device 2
Any ExeAny Exe Any CabAny Cab
Smartphone SecuritySmartphone Security
Devices can be configured by the Devices can be configured by the operatoroperator
Unlocked deviceUnlocked device
Any ExeAny Exe Any CabAny Cab
Locked device 1Locked device 1
Signed ExeSigned Exe Signed CabSigned Cab
Any ExeAny Exe Any CabAny CabSigned ExeSigned Exe Signed CabSigned Cab
Trusted ExeTrusted Exe Trusted CabTrusted Cab
Application Management Application Management ExecutionExecution
Two modes of executionTwo modes of execution Unprivileged – has access to most Unprivileged – has access to most
APIs, registry keys, and filesAPIs, registry keys, and files Privileged – has access to Privileged – has access to
everythingeverything Modes allow operators to Modes allow operators to
protect sensitive areas of the protect sensitive areas of the device and networkdevice and network
Application Management Application Management ExecutionExecution
When do you need privileged?When do you need privileged? Inbox pluginsInbox plugins Intercept SMS messagesIntercept SMS messages Device driversDevice drivers
How do you get privileged?How do you get privileged? On a test device: sign with a test On a test device: sign with a test
certcert On a shipping device: get signed On a shipping device: get signed
with an operator certwith an operator cert
Debugging ApplicationsDebugging Applications
To debug against device need to To debug against device need to sign files and provision device for sign files and provision device for cert.cert.
Packaging ProcessPackaging Process
Create a CAB file using CABWizSP Create a CAB file using CABWizSP under the SDK \Tools directoryunder the SDK \Tools directory
Create an INF file detailing application and Create an INF file detailing application and company details, files to copy, shortcut company details, files to copy, shortcut creationcreation
Application Application Package (.CAB)Package (.CAB)
Your FilesYour Files
CABWizSPCABWizSP
Information File (.inf)Information File (.inf)
Packaging ProcessPackaging Process
To enable security signed applicationsTo enable security signed applications Sign the Exe and Cab using Signcode.exeSign the Exe and Cab using Signcode.exe
Application Application Package (.CAB)Package (.CAB)
Your FilesYour Files
CABWizSPCABWizSP
Information File (.inf)Information File (.inf)
Application Management Application Management DistributionDistribution
Choose a channel to distribute your Choose a channel to distribute your applicationapplication Use Mobile2Market to increase distribution Use Mobile2Market to increase distribution
channelschannels http://www.microsoft.com/mobile/developer/developerhttp://www.microsoft.com/mobile/developer/developer
programs/mobile2market/default.aspprograms/mobile2market/default.asp
Choose a transport to distribute your Choose a transport to distribute your applicationapplication Pocket Internet ExplorerPocket Internet Explorer Email attachmentEmail attachment Storage cardStorage card ActiveSyncActiveSync
Create a PackageCreate a Package
Smartphone FuturesSmartphone Futures
Microsoft are committed to the Microsoft are committed to the platformplatform
V. Next releaseV. Next release Based on Win CE 4.2Based on Win CE 4.2 Compact Framework 1.0 in ROMCompact Framework 1.0 in ROM ATL SupportATL Support JIT DebuggingJIT Debugging RTTI / Exception HandlingRTTI / Exception Handling
.NET Compact Framework .NET Compact Framework 1.0 For Smartphone1.0 For Smartphone
Will be a feature of next version of SmartphoneWill be a feature of next version of Smartphone New UI SupportNew UI Support ROM - only – no CAB Install of FrameworkROM - only – no CAB Install of Framework Managed apps follow native security modelManaged apps follow native security model Added support for 5 new languagesAdded support for 5 new languages
Dutch, Danish, Swedish, Portuguese Brasilia, UK English Dutch, Danish, Swedish, Portuguese Brasilia, UK English Multilingual User Interface (MUI) SupportMultilingual User Interface (MUI) Support
Entire v1 feature set supportedEntire v1 feature set supported
SQL Server CE not supportedSQL Server CE not supported
NETCF Supported ControlsNETCF Supported ControlsPocket PC and Windows CE.NETPocket PC and Windows CE.NET
ButtonButtonCheckBoxCheckBoxComboBoxComboBoxContextMenuContextMenuDataGridDataGridDomainUpDownDomainUpDownFileOpenDialogFileOpenDialogHScrollBarHScrollBarImageListImageListLabelLabelListBoxListBoxListViewListViewTreeView TreeView FileSaveDialog FileSaveDialog
Supported controlsSupported controls
MainMenuMainMenuNumericUpDownNumericUpDownPanelPanelPictureBoxPictureBoxProgressBarProgressBarRadioButtonRadioButtonStatusBarStatusBarTabControlTabControlTextBoxTextBoxTimerTimerToolBarToolBarVScrollBarVScrollBarMessageBoxMessageBoxFormForm
NETCF Supported ControlsNETCF Supported ControlsSmartphoneSmartphone
ButtonCheckBoxCheckBoxComboBoxComboBoxContextMenuDataGridDomainUpDownFileOpenDialogHScrollBarHScrollBarImageListImageListLabelLabelListBoxListViewListViewTreeViewTreeView FileSaveDialog
Supported controlsSupported controlsMainMenuMainMenuNumericUpDownPanelPanelPictureBoxPictureBoxProgressBarProgressBarRadioButtonStatusBarTabControlTextBoxTextBoxTimerTimerToolBarVScrollBarVScrollBarMessageBoxMessageBoxFormForm
Smartphone ControlsSmartphone Controls
TextBoxTextBox .Multiline = True: MLE Control.Multiline = True: MLE Control .Multiline = False: Edit Control.Multiline = False: Edit Control
Smartphone ControlsSmartphone Controls
ComboBoxComboBox Action to view all items full screenAction to view all items full screen
Smartphone ControlsSmartphone Controls
TreeViewTreeView Recommended Full ScreenRecommended Full Screen No CheckBoxes on SmartphoneNo CheckBoxes on Smartphone
ListViewListView Recommended Full ScreenRecommended Full Screen
Soft Keys (Menus)Soft Keys (Menus)
Left SoftKey can not have menu itemsLeft SoftKey can not have menu items If there is no MainMenu on the formIf there is no MainMenu on the form
SoftKey press raises KeyDown and SoftKey press raises KeyDown and KeyUp eventsKeyUp events
KeyEventArgs.KeyCode is Keys.F1 and F2KeyEventArgs.KeyCode is Keys.F1 and F2
Home KeyHome Key
Home Key returns to home screen Home Key returns to home screen No KeyPress event thrown No KeyPress event thrown
So Home Key can’t be overriddenSo Home Key can’t be overridden
Back KeyBack Key
Back Key navigates back to previous screenBack Key navigates back to previous screen Next window in z - order brought to frontNext window in z - order brought to front
ExceptionsExceptions Always cancels out of modal dialogsAlways cancels out of modal dialogs Backspace when focus on TextboxBackspace when focus on Textbox When menu showing cancels out of menuWhen menu showing cancels out of menu
Overriding Default BehaviorOverriding Default Behavior Set KeyPressEventArgs.Handled = true Set KeyPressEventArgs.Handled = true Intended for custom controls or gamesIntended for custom controls or games
Control Focus And Control Focus And TabbingTabbing Focus is critical to Smartphone UI modelFocus is critical to Smartphone UI model
Up and Down navigation keys switch between controlsUp and Down navigation keys switch between controls Focusable ControlsFocusable Controls
CheckBox, ComboBox, ListView, TreeView, Form, CheckBox, ComboBox, ListView, TreeView, Form, TextBoxTextBox
Tab order goes in order of focusable controls in Tab order goes in order of focusable controls in controls collection controls collection
Custom ControlsCustom Controls Focusable unless Enabled property set to falseFocusable unless Enabled property set to false Developer must ‘tab out’ of their control by overriding Developer must ‘tab out’ of their control by overriding
the the up/down keys and giving focus to next controlup/down keys and giving focus to next control
Designer IssueDesigner Issue Designer adds controls to code in reverse orderDesigner adds controls to code in reverse order
Security And Managed Security And Managed CodeCode .NET Compact Framework adapts .NET Compact Framework adapts
native application-level security modelnative application-level security model Managed apps follow native security Managed apps follow native security
policypolicy Security check also done on P/Invoke callSecurity check also done on P/Invoke call
Application must be signed with Application must be signed with carrier approved cert to run on locked carrier approved cert to run on locked devicesdevices
Code Access Security will come in .NET Code Access Security will come in .NET Compact Framework 2.0Compact Framework 2.0 More granular security, unique to .NETMore granular security, unique to .NET
Application ArchitectureApplication Architecture
ApplicationApplicationEngineEngine
Utility Utility LibrariesLibraries
User User InterfaceInterface
ApplicationApplicationEngineEngine
Utility Utility LibrariesLibraries
Pocket PC Pocket PC UIUI
Smartphone Smartphone UIUI
Applies to Native and NETCF codeApplies to Native and NETCF code
Smartphone Developer Smartphone Developer KitKit Exclusive to MSPP Exclusive to MSPP
members (members (~550~550€)€) eVT 3.0eVT 3.0 Smartphone 2002 Smartphone 2002
SDKSDK DocumentationDocumentation WhitepapersWhitepapers SamplesSamples
Compal AR11Compal AR11 SIM UnlockedSIM Unlocked Security UnlockedSecurity Unlocked
SummarySummary
eVC++ 3.0 to target Smartphone eVC++ 3.0 to target Smartphone 20022002
Design your user interfaceDesign your user interface Left menubar is default actionLeft menubar is default action SpinnersSpinners Expandable EditsExpandable Edits Keep as simple as possibleKeep as simple as possible
Your application may need signingYour application may need signing Compact Framework is comingCompact Framework is coming
Remember To Fill Out Remember To Fill Out This Session’s Evaluation! This Session’s Evaluation!