370 likes | 646 Views
Developing Applications with eVC++ 4.0. Paul Yao President The Paul Yao Company http://www.paulyao.com. Agenda. Highlights of eVC 4.0 Tool Tips TroubleShooting. Agenda – Part 1 / 3. Highlights of eVC 4.0 What is eVC++ 4.0? Windows CE .NET Enhancements C++ Enhancements The Right Tool…
E N D
Developing Applicationswith eVC++ 4.0 Paul Yao President The Paul Yao Company http://www.paulyao.com
Agenda • Highlights of eVC 4.0 • Tool Tips • TroubleShooting
Agenda – Part 1 / 3 • Highlights of eVC 4.0 • What is eVC++ 4.0? • Windows CE .NET Enhancements • C++ Enhancements • The Right Tool… • Tool Tips • TroubleShooting
What is eVC++ 4.0? • Stand-alone development environment • Supports C & C++ • Win32 API (.EXEs & .DLLs) • Also MFC & ATL support • “Native” executables • Companion to Visual Studio .NET 2003 • C# / VB .NET • .NET Compact Framework • “Managed” executables
Windows CE .NET 4.1Enhancements • Standard SDK • Improved emulator • Kernel Independent Transport Layer (KITL) • .NET Compact Framework • CECONFIG.H • Shared source code (in Platform Builder) • Added 32MB memory for XIP-DLLs • Improved power management • http://msdn.microsoft.com/msdnmag/issues/02/07/default.aspx
C++ Enhancements • C++ structured exception handling • try • catch • Throw • Runtime Type Information (RTTI) • Standard Template Library (STL)
eVC++ 3.0 Windows CE 3.0-based smart devices Pocket PC Pocket PC 2002 Smartphone 2002 eVC++ 4.0 Windows CE .NET-based smart devices Pocket PC 2003 The Right Tool…
Remote ToolseVC++ 3.0 & eVC++ 4.0 • Remote SPY++ • Remote Registry Editor • Remote Heap Walker • Remote File Viewer • Remote Zoomin • Remote Performance Monitor • Remote System Information
Remote ToolsNew with eVC++ 4.0 • Remote Call Profiler • “Testing Real-Time Systems in Windows CE .NET” by Mike Hall and Steve Maillet • http://windowsfordevices.deviceforge.com/articles/AT2137345992.html • Kernel Tracker • Graphical display of process, thread, scheduling, & synchronization • Process Viewer
Agenda – Part 2 / 3 • Highlights of eVC 4.0 • Tool Tips • IDE Keyboard Shortcuts • Preprocessor • Compiler • Linker • TroubleShooting
IDE 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)
PreprocessorPrecompiled Headers • Key Benefit - Faster Build time • Obstacles: • Understanding Setup • Automatic versus Manual • Establishing Default Settings
Precompiled HeadersThree Modes Settings For: All Configurations Off Auto Manual
Precompiled HeadersThe Meaning of “Through header” Use Precompiled Headers Up to and including stdafx.h #include "stdafx.h" #include "propsip.h" #include <commctrl.h> #include <aygshell.h> #include <sipapi.h>
Precompiled HeadersSetup for Manual Mode (1 of 2) Select Source File “Create headers” for one source file
Precompiled HeadersSetup for Manual Mode (2 of 2) Select Source File “Use headers” for all other source files
Precompiled HeadersDefault Settings Select Project Sets default for new items added to project
I486 WIN32 STRICT USA UNICODE _UNICODE _X86_ x86 UNDER_CE=$(CEVersion) _WIN32_WCE=$(CEVersion) _WIN32_WCE_EMULATION INTLMSG_CODEPAGE INTERNATIONAL PreprocessorSymbols
PreprocessorSymbols (continued) • Windows CE Conditional Compilation • #ifdef UNDER_CE • Targeting a Specific Version • #if UNDER_CE == 300 • #if UNDER_CE >= 211 • Emulator-Specific Code • #ifdef _WIN32_WCE_EMULATION
UNICODE Effects Unicode functions are the default: MessageBox macro interpreted as MessageBoxW Unicode data structures are the default: LOGFONT macro interpreted as LOGFONTW _UNICODE Effects Modifies tchar.h TCHAR is WCHAR LPTSTR is LPWSTR _tcscpy is wcscpy _T(“x”) is L”x” TEXT(“x”) is L”x” PreprocessorSymbols (continued)
CompilerBuilding DLLs using C++ • An Include File: #include "MyLen.h" • The Source Code (MyLen.cpp): _declspec(dllexport) int _cdecl MyLen(char * p) { return 4; } • Resulting Exported Function: • ?MyLen@@YAHPAD@Z
CompilerBuilding DLLs using C++ (cont) • Solution: // MyLen.H #ifdef _cplusplus extern "C" { #endif _declspec(dllexport) int _cdecl MyLen(char * p); #ifdef _cplusplus } #endif • Resulting Exported Function: • MyLen
CompilerWin32 Message Cracker Macros • What They Are: • Macros to help build window procedures • One macro per Win32 message • Benefits of Using: • Make window procedures shorter • Correctly crack apart wParam & lParam • Correctly cast parameter values
CompilerWin32 Message Cracker Macros (cont) • BEFORE: MyWindowProc(…) { switch (msg) { case WM_PAINT: <lots of code> break; case WM_MOUSEMOVE: <lots more code> break; default: DefWindowProc(hwnd, msg, . . .); }
CompilerWin32 Message Cracker Macros (cont) • AFTER: MyWindowProc(…) { switch (msg) { HANDLE_MSG(hwnd,WM_PAINT,OnPaint); HANDLE_MSG(hwnd,WM_MOUSEMOVE,OnMove); . . . } void OnPaint(HWND hwnd) { /* WM_PAINT handling code */ } void OnSize(HWND hwnd,UINT state,int cx,int cy) { /* WM_SIZE handling code */ }
CompilerWin32 Message Cracker Macros (cont) • The definitions: • #include <windowsx.h> • A Tool: Email: info@paulyao.com For a complimentary copy
LinkerWhere is that function hiding? • Example: • Where to find "MailOpen", "MailPut", and "MailClose" • The Answer: msgstore.lib • How to solve that problem in the general case: C> dumpbin –linkermember:2 msgstore.lib>msgstore.dat C> dumpbin –linkermember:2 msmqrt.lib > msmqrt.dat
Agenda – Part 3 / 3 • Highlights of eVC 4.0 • Tool Tips • TroubleShooting • Debugging via USB • Debugging via network at home • Debugging via network at work • Emulator set up • Adding Win32 DLLs to managed projects
Debugging via USB/serial • Establish ActiveSync Partnership • Use latest version (3.6) • Select correct CPU (WCE Configuration Toolbar) • For best performance, hide Watch and Variables windows • Consider using network debugging…
Debugging via networkAt 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]<Select Adapter>[Name Servers]
Debugging via networkAt Work (with DHCP) • Attach USB/serial cable • Enable DHCP on device • Attach network card/cable • Might need to reset device
EmulatorTips for Setting 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
Managed Code ProjectsAdding Win32 DLLs • In VS .NET Solution Explorer • Add->Add Existing Item • Set Build Action = “Content” • Example: • Add “Helper.dll” • Downloaded with executable
Wrap-Up • eVC++ 4.0: • For custom devices & PocketPC 2003 • Sophisticated Tool set • Many ways to accomplish tasks • Email: info@paulyao.com • CRACKERS coding tool • CEFUN function viewer tool • Training / eCoaching for programmers
Additional Resources • For the latest news and topics on Microsoft Pocket PC and Smartphone development: www.microsoft.com/mobile/developer • For detailed information on the .NET Compact Framework and Visual Studio .NET: mobility.microsoftdev.com • For detailed information on ASP.NET Mobile controls: www.asp.net/mobile • For detailed information on Tablet PC development: www.tabletpcdeveloper.com • To become a Microsoft Mobility Solutions partner: www.microsoft.com/mobile/partner • To learn how to decrease time to market: www.microsoft.com/mobile/mobile2market • For technical information and downloads: msdn.microsoft.com • Post-conference Mobility Developer Conference infowww.mymsevents.com • Market Smartphone and Pocket PC applications to mobile operators with Mobile2Market, visit www.microsoft.com/mobile/mobile2market