31

Understanding Win32 Support In Pocket PC And Smartphone Paul Yao President The Paul Yao Company

Embed Size (px)

Citation preview

Understanding Win32 Understanding Win32 Support In Pocket PC And Support In Pocket PC And SmartphoneSmartphone

Paul YaoPaul YaoPresidentPresidentThe Paul Yao CompanyThe Paul Yao Companyhttp://http://www.paulyao.comwww.paulyao.com

AgendaAgenda

Design GoalsDesign Goals Character Set SupportCharacter Set Support KernelKernel ComponentsComponents User-InterfaceUser-Interface GraphicsGraphics ConnectivityConnectivity InternetInternet

Windows CE Design GoalsWindows CE Design Goals

SmallSmall PortablePortable ConfigurableConfigurable Win32 CompatibleWin32 Compatible Development ToolsDevelopment Tools Well-ConnectedWell-Connected Real-TimeReal-Time

General PrinciplesGeneral Principles

Unicode-OnlyUnicode-Only Focus on “Client-side” supportFocus on “Client-side” support No SecurityNo Security No “Frills”No “Frills”

Few helpers (ZeroMemory)Few helpers (ZeroMemory) Cut Win16 functionsCut Win16 functions

Leave one function when Win32 has 2+ ways Leave one function when Win32 has 2+ ways to do somethingto do something TextOut versus ExtTextOutTextOut versus ExtTextOut MoveToEx/LineTo versus PolylineMoveToEx/LineTo versus Polyline

Windows NT Supports Windows NT Supports BothBoth Unicode And Ansi Unicode And Ansi

APP.EXEAPP.EXE

MessageBoxAMessageBoxA

MessageBoxWMessageBoxW

USER32.DLLUSER32.DLL

MessageBoxWMessageBoxW

UnicodeUnicodeCompiler SupportCompiler Support

ANSI characters and stringsANSI characters and strings ‘‘H’H’ ““Hello Unicode”Hello Unicode” ==> Store as ‘char’ or ‘unsigned char’==> Store as ‘char’ or ‘unsigned char’

Unicode characters and stringsUnicode characters and strings L’H’L’H’ L”Hello Unicode”L”Hello Unicode” ==> Store as ‘short’ or ‘unsigned short’==> Store as ‘short’ or ‘unsigned short’

Bi-modal (_UNICODE)Bi-modal (_UNICODE) TEXT(‘H’)TEXT(‘H’) TEXT(“Hello Unicode”) TEXT(“Hello Unicode”)

UnicodeUnicodeData TypesData Types

ANSIANSI CHAR – resolves to charCHAR – resolves to char LPSTR – resolves to char *LPSTR – resolves to char *

UnicodeUnicode WCHAR – resolves to unsigned shortWCHAR – resolves to unsigned short LPWSTR – resolves to unsigned short *LPWSTR – resolves to unsigned short *

Bi-Modal (_UNICODE)Bi-Modal (_UNICODE) TCHAR – resolves to char or TCHAR – resolves to char or

unsigned shortunsigned short LPTSTR – resolves to char * LPTSTR – resolves to char *

or unsigned short *or unsigned short *

UnicodeUnicodeC-Runtime FunctionsC-Runtime Functions

ANSIANSI strlen() – query lengthstrlen() – query length strcpy() – copy stringstrcpy() – copy string strcat() – concatenate stringstrcat() – concatenate string

UnicodeUnicode wcslen() – query lengthwcslen() – query length wcscpy() – copy stringwcscpy() – copy string wcscat() – concatenate stringwcscat() – concatenate string

Bi-Modal (_UNICODE)Bi-Modal (_UNICODE) _tcslen() – query length_tcslen() – query length _tcscpy() – copy string_tcscpy() – copy string _tcscat() – concatenate string_tcscat() – concatenate string

Unicode ConversionUnicode Conversion

FunctionsFunctions mbstowcs – To Unicode ("mbstowcs – To Unicode ("WWide-character string")ide-character string") wcstombs – From Unicodewcstombs – From Unicode

Establish a clear boundary between Unicode and Establish a clear boundary between Unicode and Non-Unicode FunctionsNon-Unicode Functions

The Outside WorldThe Outside World

Windows CEWindows CE

ANSIANSI

UnicodeUnicode

ANSIANSI

UnicodeUnicode

ClearClearboundaryboundary

UnclearUnclearboundaryboundary

??

COREDLL.DLLCOREDLL.DLL

Has 1600+ FunctionsHas 1600+ Functions KERNELKERNEL

Processes and ThreadsProcesses and Threads Synchronization objectsSynchronization objects Memory and File mappingMemory and File mapping Object Store – files, registry, databasesObject Store – files, registry, databases

USERUSER Windows, menusWindows, menus Dialog boxes, property sheetsDialog boxes, property sheets Cursors, caretsCursors, carets

COREDLL.DLLCOREDLL.DLL

GDIGDI Text, raster, vector outputText, raster, vector output PalettesPalettes Printing (except on Palm size PC)Printing (except on Palm size PC)

MultimediaMultimedia Audio Compression Mgr (AcmDriverID)Audio Compression Mgr (AcmDriverID) Sound (sndPlaySoundW)Sound (sndPlaySoundW)

Encryption API (CryptEncrypt)Encryption API (CryptEncrypt)

COREDLL.DLLCOREDLL.DLL

C-Runtime FunctionsC-Runtime Functions Remote Access Services (RAS)Remote Access Services (RAS) TAPI (lineOpen)TAPI (lineOpen) Localization Support (GetTimeFormat)Localization Support (GetTimeFormat) Windows Networking (WNet… APIs)Windows Networking (WNet… APIs) CE-Specific APIsCE-Specific APIs

Databases (CeOpenDatabase)Databases (CeOpenDatabase) Notifications (CeRunAppAtTime)Notifications (CeRunAppAtTime)

Kernel: Features SupportedKernel: Features Supported

ProcessesProcesses ThreadsThreads Synchronization Synchronization

ObjectsObjects MemoryMemory

Dynamic Shared Dynamic Shared sectionssections

Static shared Static shared sectionssections

Memory mapped filesMemory mapped files Thread local storageThread local storage

Win32 ExceptionsWin32 Exceptions __try__try __except__except __finally__finally __leave__leave

Dynamic Link Dynamic Link LibrariesLibraries

File I/OFile I/O Long File NamesLong File Names RegistryRegistry ClipboardClipboard

Kernel: Features MissingKernel: Features Missing

Fibers (*)Fibers (*) .INI file Access.INI file Access C++ Exceptions (*)C++ Exceptions (*)

trytry throwthrow catchcatch

Win16 Registry Win16 Registry FunctionsFunctions

GlobalAllocGlobalAlloc AtomsAtoms

Dynamic Data Dynamic Data Exchange (DDE)Exchange (DDE)

Object Linking and Object Linking and Embedding (OLE)Embedding (OLE)

WaitForMultipleObjectsWaitForMultipleObjects bWaitAll must be FALSEbWaitAll must be FALSE

NT-Style ServicesNT-Style Services

(*) Windows CE .NET supports this feature(*) Windows CE .NET supports this feature

Kernel: Windows CE-SpecificKernel: Windows CE-Specific

Thread QuantumThread Quantum CeSetThreadQuantumCeSetThreadQuantum

Thread PrioritiesThread Priorities CeSetThreadPriorityCeSetThreadPriority 256 priorities in 256 priorities in

Windows CE 3.0Windows CE 3.0

CE DatabasesCE Databases Installable Stream Installable Stream

DriversDrivers

ActiveSyncActiveSync Power ManagementPower Management NKDbgPrintfWNKDbgPrintfW

OutputDebugStringOutputDebugString wsprintfwsprintf

ComponentsComponents

Features SupportedFeatures Supported Component Object Component Object

Model (COM)Model (COM) In-Process ServersIn-Process Servers Local ServersLocal Servers Distributed COM Distributed COM

(DCOM)(DCOM)

AutomationAutomation ActiveX Template ActiveX Template

Library (ATL)Library (ATL)

Features MissingFeatures Missing COM+COM+ MTSMTS MSMQ Queued MSMQ Queued

Components (COM Components (COM object integration)object integration)

User-InterfaceUser-Interface

Features SupportedFeatures Supported WindowsWindows SubclassingSubclassing Dialog BoxesDialog Boxes Common Dialog Common Dialog

BoxesBoxes Common ControlsCommon Controls CursorsCursors CaretsCarets

Features MissingFeatures Missing Pure MenusPure Menus

Use “command bars” Use “command bars” insteadinstead

Some Common Some Common DialogsDialogs

Some Common Some Common ControlsControls

Property Sheet Property Sheet WizardsWizards

HooksHooks

GraphicsGraphics

Features Supported Features Supported TextText

Truetype fontsTruetype fonts

RasterRaster DIBsDIBs

VectorVector PrintingPrinting DirectDrawDirectDraw Game API (GAPI)Game API (GAPI)

Features MissingFeatures Missing Coordinate Coordinate

transformationtransformation Image Color Image Color

Matching (ICM)Matching (ICM) MetafilesMetafiles OpenGL (3-D library)OpenGL (3-D library)

ConnectivityConnectivity

Features SupportedFeatures Supported Windows Sockets Windows Sockets

API (winsock)API (winsock) Internet Helper APIInternet Helper API WinInet APIWinInet API Telephony API Telephony API

(TAPI 2.1)(TAPI 2.1) Microsoft Message Microsoft Message

Queue (MSMQ)Queue (MSMQ) Message API (MAPI)Message API (MAPI)

Features MissingFeatures Missing Asynchronous Asynchronous

socketssockets

InternetInternetFeatures SupportedFeatures Supported

Web ServerWeb Server Active Server Pages SupportedActive Server Pages Supported Requires Platform BuilderRequires Platform Builder

XML Parser 2.5XML Parser 2.5 Pocket Internet ExplorerPocket Internet Explorer Internet Explorer for Windows CEInternet Explorer for Windows CE

InternetInternetWeb BrowsersWeb Browsers

Pocket Internet ExplorerPocket Internet Explorer HTML 3.2HTML 3.2 Size (x86): 1.3MBSize (x86): 1.3MB Runs On: PocketPC, Runs On: PocketPC,

Embedded DevicesEmbedded Devices

Internet Explorer for Internet Explorer for Windows CEWindows CE HTML 4.0HTML 4.0 FramesFrames Cascading Style Sheet (CSS)Cascading Style Sheet (CSS) Dynamic HTMLDynamic HTML ActiveX ControlsActiveX Controls Java AppletsJava Applets Size (x86): 3.1MBSize (x86): 3.1MB Runs On: Custom Runs On: Custom

Embedded DevicesEmbedded Devices LacksLacks

Client-side data bindingClient-side data binding VBScript SupportVBScript Support

Windows CE-SpecificWindows CE-SpecificFeaturesFeatures

Power ManagementPower Management NotificationsNotifications DatabasesDatabases Desktop ConnectivityDesktop Connectivity

RAPIRAPI ActiveSyncActiveSync

Command BarsCommand Bars Installable User-Mode DriversInstallable User-Mode Drivers

Windows CE-SpecificWindows CE-SpecificFunctions and MessagesFunctions and Messages

CreateFileForMappingCreateFileForMapping GetClipboardDataAllocGetClipboardDataAlloc GetKeyboardStatusGetKeyboardStatus GetMessageSourceGetMessageSource GetMouseMovePointsGetMouseMovePoints RandomRandom RegisterDeviceRegisterDevice SHShowOutOfMemorySHShowOutOfMemory TransparentImageTransparentImage WM_HIBERNATEWM_HIBERNATE

CEFUN.EXECEFUN.EXEA Free UtilityA Free Utility

QueriesQueries DLLs and FunctionsDLLs and Functions Both Documented and Both Documented and

UndocumentedUndocumented

LimitsLimits No macrosNo macros No window classesNo window classes No COM interfacesNo COM interfaces

Available fromAvailable from [email protected]@paulyao.com

Wrap-UpWrap-Up

Win32 API on Windows CEWin32 API on Windows CE ““Greatest Hits” of Windows APIGreatest Hits” of Windows API Share Source with Existing Windows Share Source with Existing Windows

ApplicationsApplications Visit Visit http://http://www.paulyao.comwww.paulyao.com

CEFUN function viewer toolCEFUN function viewer tool Info on Windows CE training classesInfo on Windows CE training classes

ResourcesResources http://www.egroups.com/community/windowhttp://www.egroups.com/community/window

sce-devsce-dev – Great community – Great community

http://www.pocketpc.comhttp://www.pocketpc.com – Good Tips – Good Tips

Remember To Fill Out Remember To Fill Out This Session’s Evaluation! This Session’s Evaluation!

To access the evals you must be logged into To access the evals you must be logged into mymsevents.commymsevents.com Go to – Go to –

http://www.mymsevents.com/MyMSEvents/mobile/Survey/Suhttp://www.mymsevents.com/MyMSEvents/mobile/Survey/SurveySelect.aspxrveySelect.aspx – mobile– mobile

http://www.mymsevents.com/MyMSEvents/Survey/SurveySelhttp://www.mymsevents.com/MyMSEvents/Survey/SurveySelect.aspxect.aspx – web site– web site

For more detailed information about filling out For more detailed information about filling out evaluations please refer to either the Conference evaluations please refer to either the Conference Guide or the CommNet under “Evaluations”Guide or the CommNet under “Evaluations”

You can do this using your PocketPC, Laptop, You can do this using your PocketPC, Laptop, PC or the CommNet machines in Hall JPC or the CommNet machines in Hall J

Additional ResourcesAdditional Resources For the latest news and topics on Microsoft Pocket PC and Smartphone For the latest news and topics on Microsoft Pocket PC and Smartphone

development: development: www.microsoft.com/mobile/developerwww.microsoft.com/mobile/developer For detailed information on the .NET Compact Framework and Visual For detailed information on the .NET Compact Framework and Visual

Studio .NET: mobility.microsoftdev.comStudio .NET: mobility.microsoftdev.com For detailed information on ASP.NET Mobile controls: For detailed information on ASP.NET Mobile controls:

www.asp.net/mobile www.asp.net/mobile For detailed information on Tablet PC development: For detailed information on Tablet PC development:

www.tabletpcdeveloper.com www.tabletpcdeveloper.com To become a Microsoft Mobility Solutions partner: To become a Microsoft Mobility Solutions partner:

www.microsoft.com/mobile/partnerwww.microsoft.com/mobile/partner To learn how to decrease time to market: To learn how to decrease time to market:

www.microsoft.com/mobile/mobile2marketwww.microsoft.com/mobile/mobile2market For technical information and downloads: msdn.microsoft.comFor technical information and downloads: msdn.microsoft.com Post-conference Mobility Developer Conference infoPost-conference Mobility Developer Conference info

www.mymsevents.comwww.mymsevents.com Market Smartphone and Pocket PC applications to mobile operators Market Smartphone and Pocket PC applications to mobile operators

with Mobile2Market, visit www.microsoft.com/mobile/mobile2market with Mobile2Market, visit www.microsoft.com/mobile/mobile2market

DiscussionDiscussion

Thank You!Thank You!