Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming With eMbedded Visual C++ 4.0 Paul Yao The Paul Yao Company

Similar presentations


Presentation on theme: "Programming With eMbedded Visual C++ 4.0 Paul Yao The Paul Yao Company"— Presentation transcript:

1

2 Programming With eMbedded Visual C++ 4.0 Paul Yao The Paul Yao Company http://www.paulyao.com

3 Display USB or Serial Processor Memory GSM/GPRS CDMA/1xRTT Device Hardware WiFi Bluetooth Radio Drivers Windows Mobile CE DB ActiveSync Pocket Outlook Pocket Internet Explorer Windows Media Player Windows CE Software Platform (APIs) Home Screen User Interface/Shell HTML Control GAPI Remote API Configuration Bluetooth Security Connection Manager TAPI SMS MAPI POOM ActiveSync Multimedia Communication Device Management Presentation ADO CE XML CE DB OLE DB Data Access Native Win32 MFCATL Managed.NET Compact Framework Server side ASP.NET Mobile Controls Native Win32 MFCATL Managed.NET Compact Framework Server side ASP.NET Mobile Controls Windows Mobile Development Platform : Today Embedded VC++ Visual Studio.NET

4 Agenda Part 1: The Tools Part 2: Tool Tips Part 3: Native or Managed?

5 Part 1: The Tools What is eMbedded Visual C++ 4.0? New features since eVC++ 3.0 C++ Enhancements Remote Tools

6 What Is eVC++ 4.0? Stand-alone development environment Build “native” executables Languages: C, C++ APIs: Win32 API, MFC Template Libraries: ATL & WTL Companion to Visual Studio.NET 2003 Build “managed” executables Languages: C#, Visual Basic.NET API:.NET Compact Framework

7 New Features in eVC++ 4.0 Since eVC++ 3.0 Improved emulator Greater fidelity to device OS image ActiveSync connections (via network virtual switch) Improved Debugging Attach to running process JIT attach to hung process

8 C++ Enhancements C++ structured exception handling trycatchthrow Runtime Type Information (RTTI) Standard Template Library (STL)

9 Remote Tools eVC++ 3.0 & eVC++ 4.0 Remote Spy++ Remote Registry Editor Remote Heap Walker Remote Process Viewer Remote Zoomin Remote File Viewer

10 Remote Tools New with eVC++ 4.0 (1/2) Remote Call Profiler “Testing Real-Time Systems in Windows CE.NET” by Mike Hall and Steve Maillet http://www.windowsfordevices.com/articles/A T2137345992.html Remote Kernel Tracker ProcessesThreadsInterrupts

11 Remote Tools New with eVC++ 4.0 (2/2) Remote Performance Monitor Graphical display with continual monitoring Tracks: CPU usage, threads, processes, memory, network traffic, battery, among other values Remote System Information Snapshot of system state Shows: OS version, CPU info, OEM code page, memory, power state, object store usage, active devices (COM1:, COM2:, etc.), user- interface colors, system metrics

12 Part 2: Tool Tips Setup Text Editor Project Settings LinkerEmulator Debugger Tips

13 Setup Tip #1: Use the right tool… eVC++ 3.0 For Windows CE 3.0 Pocket PC Pocket PC 2002 Smartphone 2002 eVC++ 4.0 For Windows CE.NET version 4.0 version 4.1 version 4.2 Pocket PC 2003 Smartphone 2003

14 Setup Tip #2: eVC++ 4.0 Upgrade to Service Pack 3 Before – SP tied to OS version: Windows CE 4.0 – no service pack Windows CE 4.1 – required SP1 Windows CE 4.2 – required SP2 SP3 Supports: Windows CE 4.0 Windows CE 4.1 Windows CE 4.2 Recommendation: Upgrade – today! http://www.microsoft.com/downloads/details.aspx?FamilyID=5b b36f3e-5b3d-419a-9610-2fe53815ae3b&DisplayLang=en

15 Setup Tip #3: Use latest version of ActiveSync  Latest Version: 3.7.1  Devices and Version Pocket PC – ActiveSync 3.1 Pocket PC 2002 – ActiveSync 3.5 Smartphone 2002 – ActiveSync 3.6 Pocket PC 2003 – ActiveSync 3.7 Smartphone 2003 – ActiveSync 3.7.1 Reference: Chris De Herrera’s Web site http://www.cewindows.net

16 Setup Tip #4: Install RTTI on PPC 2003 Pocket PC 2003 – does not support… C++ structured exceptions Run-time Type Information (RTTI) Standard Template Library (STL) Support can be added: Download RITTI.EXE from MS web site Portions install on development system Portions install on device Google ® for… “RTTI Pocket PC” or “KB830482”

17 Text Editor Tip: Use keyboard shortcuts [F1] - Context Sensitive help [F4] - [Next] (Error, Search result, etc.) [F6] - [Next Window] [F9] - [Set Breakpoint] at cursor [Tab] - Indent blocks of text [Ctrl] + [End] – Enable auto scroll for output windows (build, debug, find)

18 IDE Tip For Project Settings: Use ‘All Configurations’

19 Linker Tip Finding missing functions Example: Where to find "MailOpen", "MailPut", and "MailClose" The Answer: msgstore.lib Solving the general case: C> dumpbin –linkermember:2 msgstore.lib>msgstore.dat C> dumpbin –linkermember:2 msmqrt.lib > msmqrt.dat

20 Emulator Tip: Getting Set Up Operating System: Use Win 2000 sp2, or WinXP Cannot use Win 9x/Me Communications: Requires TCP/IP (Internet) Protocol Machine Name must start with letter Tip: Login with Administrator privileges Install Microsoft Loopback Adapter

21 Debugger Tip #1: USB/Serial Connection Establish ActiveSync Partnership Use latest version (3.7.1) Select correct CPU (WCE Configuration Toolbar) For best performance, hide Watch and Variables windows Consider using network debugging…

22 Debugger Tip #2: Using a Network At Home (no DHCP) Establish partnership via USB/serial Static IP address on desktop Static IP Address on smart device Set WINS address to desktop IP address Start->Settings-> [Connections] [Network] [Adapters] [Name Servers]

23 Debugger Tip #3: Using a network At Work (with DHCP) Desktop-Side Enable network connections Connect via USB/serial Device-Side Enable network connections in ActiveSync Enable DHCP for network adapter Attach network adapter Might need to reset device Connect to Network WiredWireless

24 Part 3: Native Or Managed? Which is better? A comparison When to use native code / managed code Bridging the gap P/Invoke The P/Invoke Wizard Building Native DLLs Compiler Download native DLLs for managed projects from Visual Studio.NET

25 A Comparison Native Code C/C++ & Win32 API EXEs & DLLs Native CPU instructions Portable source code Manual cleanup ActiveX / COM No run-time required (OS is the runtime) Managed Code C#/VB.NET &.NET CF EXEs & DLLs IL instructions; JIT to native CPU instructions Portable binary code Garbage Collection COM not supported Run-time required 2.0 MB footprint Requires support from underlying Windows CE operating system In ROM for all Windows Mobile devices

26 When To Use… Native code… Device drivers Shell extensions Today screen Control panel Custom input panel Skinnable UI Serial port I/O Application setup (CESetup.dll) Remote API (RAPI) for device-side DLL Web service server Real-time threads CE property databases ActiveX / COM ActiveSync provider Mail API (MAPI) Native XML parser Object exchange (OBEX) Pocket Outlook Object Model (POOM) Wrapper for COM library Callable from managed code

27 When To Use… Managed code… On devices with.NET Compact Framework Windows Mobile 2003-based devices Custom display-based smart devices GUI application code Forms, controls custom controls Web service clients Database (ADO.NET) clients Build managed DLLs Shared class libraries Custom controls Managed code benefits: Well designed API Automatic garbage collection Portable binary files Interoperability with desktop.NET Framework

28 Bridging The Gap Platform Invoke (P/Invoke) Managed code feature Supports calling native DLLs C-callable function names (not C++ ‘mangled’ names) Parameter types w/built-in support: Blittable types – integers (8, 16, 32 bit), strings Arrays of blittable types Other parameter types require more effort: Character arrays within structures Nested objects Unions

29 A Helper: The P/Invoke Wizard Download from: http://www.paulyao.com/pinvoke

30 Building DLLs Problems with C++ “name decorating” An Include File: #include "MyLen.h" The Source Code (MyLen.cpp): _declspec(dllexport) int _cdecl MyLen(char * p) { return 4; return 4;} Resulting Exported Function: ?MyLen@@YAHPAD@Z

31 Building DLLs Unmangling function names Solution: // MyLen.H #ifdef _cplusplus extern "C" { #endif _declspec(dllexport) int _cdecl MyLen(char * p); #ifdef _cplusplus }#endif Resulting Exported Function: MyLen

32 Managed Code Project Tip Downloading native DLLs In VS.NET Solution Explorer Add->Add Existing Item Set Build Action = “Content” Example: Add “Helper.dll” Downloaded with executable

33 Wrap-Up eVC++ 4.0: Native code for Windows CE.NET 4.x Upgrade to Service Pack 3 Certain scenarios require native code Build native DLLs to support managed code Contact Us: info@paulyao.com The Paul Yao Company’s Weekend Warrior Workshops for Windows Mobile programmer Other training workshops Our online eCoaching for Programmers series

34 After This Session… Visit the Windows Mobile booth to: Get the Windows Mobile Developer Resource Kit and start supporting landscape and high DPI Talk to the Technical Support team Join the Windows Mobile Solutions Partner Program Enter the Microsoft Mobile2Market Application Contest Fill in your evaluation form sponsored by AT&T Wireless 1 MPX200 given away per session. See www.mscorpevents.com/mdc www.mscorpevents.com/mdc

35 Your Questions…

36 Thank You!

37 © 2004 Microsoft Corporation. All rights reserved. MICROSOFT CONFIDENTIAL. INTERNAL USE ONLY.


Download ppt "Programming With eMbedded Visual C++ 4.0 Paul Yao The Paul Yao Company"

Similar presentations


Ads by Google