developing applications with evc++ 4.0 paul yao president the paul yao company
TRANSCRIPT
Developing ApplicationsDeveloping Applicationswith eVC++ 4.0with eVC++ 4.0
Paul YaoPaul YaoPresidentPresidentThe Paul Yao CompanyThe Paul Yao Companyhttp://http://www.paulyao.comwww.paulyao.com
AgendaAgenda Highlights of eVC 4.0Highlights of eVC 4.0 Tool TipsTool Tips TroubleShootingTroubleShooting
Agenda – Part 1 / 3Agenda – Part 1 / 3 Highlights of eVC 4.0Highlights of eVC 4.0
What is eVC++ 4.0?What is eVC++ 4.0? Windows CE .NET EnhancementsWindows CE .NET Enhancements C++ EnhancementsC++ Enhancements The Right Tool…The Right Tool…
Tool TipsTool Tips TroubleShootingTroubleShooting
What is eVC++ 4.0?What is eVC++ 4.0?
Stand-alone development environmentStand-alone development environment Supports C & C++Supports C & C++ Win32 API (.EXEs & .DLLs)Win32 API (.EXEs & .DLLs) Also MFC & ATL supportAlso MFC & ATL support ““Native” executablesNative” executables
Companion to Visual Studio .NET 2003Companion to Visual Studio .NET 2003 C# / VB .NETC# / VB .NET .NET Compact Framework.NET Compact Framework ““Managed” executablesManaged” executables
Windows CE .NET 4.1Windows CE .NET 4.1EnhancementsEnhancements Standard SDKStandard SDK Improved emulatorImproved emulator Kernel Independent Transport Layer (KITL)Kernel Independent Transport Layer (KITL) .NET Compact Framework.NET Compact Framework CECONFIG.HCECONFIG.H Shared source code (in Platform Builder)Shared source code (in Platform Builder) Added 32MB memory for XIP-DLLsAdded 32MB memory for XIP-DLLs Improved power managementImproved power management http://msdn.microsoft.com/msdnmag/issues/http://msdn.microsoft.com/msdnmag/issues/
02/07/default.aspx02/07/default.aspx
C++ EnhancementsC++ Enhancements
C++ structured exception handlingC++ structured exception handling trytry catchcatch ThrowThrow
Runtime Type Information (RTTI)Runtime Type Information (RTTI) Standard Template Library (STL)Standard Template Library (STL)
The Right Tool…The Right Tool…
eVC++ 3.0eVC++ 3.0 Windows CE 3.0-Windows CE 3.0-
based smart based smart devicesdevices
Pocket PCPocket PC Pocket PC 2002Pocket PC 2002 Smartphone 2002Smartphone 2002
eVC++ 4.0eVC++ 4.0 Windows CE .NET-Windows CE .NET-
based smart based smart devicesdevices
Pocket PC 2003Pocket PC 2003
Remote ToolsRemote ToolseVC++ 3.0 & eVC++ 4.0eVC++ 3.0 & eVC++ 4.0 Remote SPY++Remote SPY++ Remote Registry EditorRemote Registry Editor Remote Heap WalkerRemote Heap Walker Remote File ViewerRemote File Viewer Remote ZoominRemote Zoomin Remote Performance MonitorRemote Performance Monitor Remote System InformationRemote System Information
Remote ToolsRemote ToolsNew with eVC++ 4.0New with eVC++ 4.0 Remote Call ProfilerRemote Call Profiler
““Testing Real-Time Systems in Windows Testing Real-Time Systems in Windows CE .NET” by Mike Hall and Steve MailletCE .NET” by Mike Hall and Steve Maillet
http://windowsfordevices.deviceforge.cohttp://windowsfordevices.deviceforge.com/articles/AT2137345992.htmlm/articles/AT2137345992.html
Kernel TrackerKernel Tracker Graphical display of process, thread, Graphical display of process, thread,
scheduling, & synchronizationscheduling, & synchronization
Process ViewerProcess Viewer
Agenda – Part 2 / 3Agenda – Part 2 / 3 Highlights of eVC 4.0Highlights of eVC 4.0 Tool TipsTool Tips
IDE Keyboard ShortcutsIDE Keyboard Shortcuts PreprocessorPreprocessor CompilerCompiler LinkerLinker
TroubleShootingTroubleShooting
IDE Keyboard ShortcutsIDE Keyboard Shortcuts
[F1] - Context Sensitive help[F1] - Context Sensitive help [F4] - [Next] (Error, Search result, etc.)[F4] - [Next] (Error, Search result, etc.) [F6] - [Next Window][F6] - [Next Window] [F9] - [Set Breakpoint] at cursor[F9] - [Set Breakpoint] at cursor [Tab] - Indent blocks of text[Tab] - Indent blocks of text [Ctrl] + [End] – Enable auto scroll for [Ctrl] + [End] – Enable auto scroll for
output windows (build, debug, find)output windows (build, debug, find)
PreprocessorPreprocessorPrecompiled HeadersPrecompiled Headers Key Benefit - Faster Build timeKey Benefit - Faster Build time Obstacles:Obstacles:
Understanding SetupUnderstanding Setup Automatic versus ManualAutomatic versus Manual Establishing Default SettingsEstablishing Default Settings
Precompiled HeadersPrecompiled HeadersThree ModesThree Modes
Settings For: Settings For: All All ConfigurationsConfigurations
OffOff
AutoAuto
ManuaManuall
Precompiled HeadersPrecompiled HeadersThe Meaning of “Through header”The Meaning of “Through header”
#include "stdafx.h"#include "stdafx.h"#include "propsip.h"#include "propsip.h"#include <commctrl.h>#include <commctrl.h>#include <aygshell.h>#include <aygshell.h>#include <sipapi.h>#include <sipapi.h>
Use Use Precompiled Precompiled Headers Up Headers Up
to and to and including including stdafx.hstdafx.h
Precompiled HeadersPrecompiled HeadersSetup for Manual Mode (1 of 2)Setup for Manual Mode (1 of 2)
Select Source FileSelect Source File ““Create Create headers” headers” for one for one source source
filefile
Precompiled HeadersPrecompiled HeadersSetup for Manual Mode (2 of 2)Setup for Manual Mode (2 of 2)
Select Source FileSelect Source File
““Use Use headers” headers”
for all for all other other
source source filesfiles
Precompiled HeadersPrecompiled HeadersDefault SettingsDefault Settings
Select ProjectSelect Project
Sets Sets default default for new for new items items added added
to to projectproject
PreprocessorPreprocessorSymbolsSymbols I486I486 WIN32WIN32 STRICTSTRICT USAUSA UNICODEUNICODE _UNICODE_UNICODE _X86__X86_ x86x86
UNDER_CE=$(CEVersion)UNDER_CE=$(CEVersion) _WIN32_WCE=$(CEVersion)_WIN32_WCE=$(CEVersion) _WIN32_WCE_EMULATION_WIN32_WCE_EMULATION INTLMSG_CODEPAGEINTLMSG_CODEPAGE INTERNATIONALINTERNATIONAL
PreprocessorPreprocessorSymbols (continued)Symbols (continued) Windows CE Conditional CompilationWindows CE Conditional Compilation
#ifdef UNDER_CE#ifdef UNDER_CE Targeting a Specific VersionTargeting a Specific Version
#if UNDER_CE == 300#if UNDER_CE == 300 #if UNDER_CE >= 211#if UNDER_CE >= 211
Emulator-Specific CodeEmulator-Specific Code #ifdef _WIN32_WCE_EMULATION#ifdef _WIN32_WCE_EMULATION
PreprocessorPreprocessorSymbols (continued)Symbols (continued)UNICODE EffectsUNICODE Effects Unicode functions Unicode functions
are the default:are the default: MessageBoxMessageBox macro macro
interpreted as interpreted as MessageBoxWMessageBoxW
Unicode data Unicode data structures are the structures are the default:default: LOGFONTLOGFONT macro macro
interpreted as interpreted as LOGFONTWLOGFONTW
_UNICODE _UNICODE EffectsEffects Modifies tchar.hModifies tchar.h TCHARTCHAR is is WCHARWCHAR LPTSTRLPTSTR is is LPWSTRLPWSTR _tcscpy_tcscpy is is wcscpywcscpy _T(“x”)_T(“x”) is is L”x”L”x” TEXT(“x”)TEXT(“x”) is is L”x”L”x”
CompilerCompilerBuilding DLLs using C++Building DLLs using C++ An Include File:An Include File:
#include "MyLen.h"#include "MyLen.h"
The Source Code (MyLen.cpp):The Source Code (MyLen.cpp):_declspec(dllexport) int _cdecl _declspec(dllexport) int _cdecl
MyLen(char * p)MyLen(char * p)
{{
return 4;return 4;
}}
Resulting Exported Function:Resulting Exported Function: ?MyLen@@YAHPAD@Z?MyLen@@YAHPAD@Z
CompilerCompilerBuilding DLLs using C++ (cont)Building DLLs using C++ (cont) Solution:Solution:
// MyLen.H// MyLen.H
#ifdef _cplusplus#ifdef _cplusplus
extern "C" {extern "C" {#endif#endif_declspec(dllexport) int _cdecl MyLen(char * p);_declspec(dllexport) int _cdecl MyLen(char * p);
#ifdef _cplusplus#ifdef _cplusplus
}}
#endif#endif
Resulting Exported Function: Resulting Exported Function: MyLenMyLen
CompilerCompilerWin32 Message Cracker MacrosWin32 Message Cracker Macros What They Are:What They Are:
Macros to help build window proceduresMacros to help build window procedures One macro per Win32 messageOne macro per Win32 message
Benefits of Using:Benefits of Using: Make window procedures shorterMake window procedures shorter Correctly crack apart wParam & lParamCorrectly crack apart wParam & lParam Correctly cast parameter valuesCorrectly cast parameter values
CompilerCompilerWin32 Message Cracker Macros (cont)Win32 Message Cracker Macros (cont) BEFORE:BEFORE:
MyWindowProc(…) {MyWindowProc(…) {
switch (msg) {switch (msg) {
case WM_PAINT:case WM_PAINT:
<lots of code><lots of code>
break;break;
case WM_MOUSEMOVE:case WM_MOUSEMOVE:
<lots more code><lots more code>
break;break;
default: default:
DefWindowProc(hwnd, msg, . . .);DefWindowProc(hwnd, msg, . . .);
}}
CompilerCompilerWin32 Message Cracker Macros (cont)Win32 Message Cracker Macros (cont) AFTER:AFTER:
MyWindowProc(…) {MyWindowProc(…) {
switch (msg) {switch (msg) {
HANDLE_MSG(hwnd,WM_PAINT,OnPaint);HANDLE_MSG(hwnd,WM_PAINT,OnPaint);
HANDLE_MSG(hwnd,WM_MOUSEMOVE,OnMove);HANDLE_MSG(hwnd,WM_MOUSEMOVE,OnMove);
. . . }. . . }void OnPaint(HWND hwnd) {void OnPaint(HWND hwnd) {
/* WM_PAINT handling code *//* WM_PAINT handling code */
}}
void OnSize(HWND hwnd,UINT state,int cx,int cy) void OnSize(HWND hwnd,UINT state,int cx,int cy) {{
/* WM_SIZE handling code *//* WM_SIZE handling code */
}}
CompilerCompilerWin32 Message Cracker Macros (cont)Win32 Message Cracker Macros (cont) The definitions:The definitions:
#include <windowsx.h>#include <windowsx.h>
A Tool:A Tool:
Email: Email: [email protected] a complimentary copyFor a complimentary copy
LinkerLinkerWhere is that function hiding?Where is that function hiding? Example:Example:
Where to find "Where to find "MailOpenMailOpen", "", "MailPutMailPut", and ", and ""MailCloseMailClose""
The Answer: The Answer: msgstore.libmsgstore.lib
How to solve that problem in the How to solve that problem in the general case:general case:C> dumpbin –linkermember:2 msgstore.lib>msgstore.datC> dumpbin –linkermember:2 msgstore.lib>msgstore.dat
C> dumpbin –linkermember:2 msmqrt.lib > msmqrt.datC> dumpbin –linkermember:2 msmqrt.lib > msmqrt.dat
Agenda – Part 3 / 3Agenda – Part 3 / 3 Highlights of eVC 4.0Highlights of eVC 4.0 Tool TipsTool Tips TroubleShootingTroubleShooting
Debugging via USBDebugging via USB Debugging via network at homeDebugging via network at home Debugging via network at workDebugging via network at work Emulator set upEmulator set up Adding Win32 DLLs to managed projectsAdding Win32 DLLs to managed projects
Debugging via USB/serialDebugging via USB/serial
Establish ActiveSync PartnershipEstablish ActiveSync Partnership Use latest version (3.6)Use latest version (3.6)
Select correct CPU (WCE Configuration Select correct CPU (WCE Configuration Toolbar)Toolbar)
For best performance, hide Watch and For best performance, hide Watch and Variables windowsVariables windows
Consider using network debugging…Consider using network debugging…
Debugging via networkDebugging via networkAt Home (no DHCP)At Home (no DHCP) Establish partnership via Establish partnership via
USB/serialUSB/serial Static IP address on Static IP address on
desktopdesktop Static IP Address on Static IP Address on
smart devicesmart device Set WINS address to Set WINS address to
desktop IP addressdesktop IP address Start->Settings-> Start->Settings->
[Connections][Connections][Network] [Adapters][Network] [Adapters]<Select Adapter><Select Adapter>[Name Servers][Name Servers]
Debugging via networkDebugging via networkAt Work (with DHCP)At Work (with DHCP) Attach USB/serial cableAttach USB/serial cable Enable DHCP on deviceEnable DHCP on device Attach network card/cableAttach network card/cable Might need to reset deviceMight need to reset device
EmulatorEmulatorTips for Setting UpTips for Setting Up Operating System:Operating System:
Use Win 2000 sp2, or WinXPUse Win 2000 sp2, or WinXP Cannot use Win 9x/MeCannot use Win 9x/Me
Communications:Communications: Requires TCP/IP (Internet) ProtocolRequires TCP/IP (Internet) Protocol Machine Name must start with letterMachine Name must start with letter
Tip:Tip: Login with Administrator privilegesLogin with Administrator privileges Install Microsoft Loopback AdapterInstall Microsoft Loopback Adapter
Managed Code ProjectsManaged Code ProjectsAdding Win32 DLLsAdding Win32 DLLs In VS .NET Solution In VS .NET Solution
ExplorerExplorer Add->Add Existing ItemAdd->Add Existing Item Set Build Action = Set Build Action =
“Content”“Content” Example:Example:
Add “Helper.dll”Add “Helper.dll” Downloaded with Downloaded with
executableexecutable
Wrap-UpWrap-Up
eVC++ 4.0:eVC++ 4.0: For custom devices & PocketPC 2003For custom devices & PocketPC 2003 Sophisticated Tool setSophisticated Tool set Many ways to accomplish tasksMany ways to accomplish tasks
Email: Email: [email protected]@paulyao.com CRACKERS coding toolCRACKERS coding tool CEFUN function viewer toolCEFUN function viewer tool Training / eCoaching for programmersTraining / eCoaching for programmers
Your Questions…Your Questions…
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: Studio .NET: mobility.microsoftdev.commobility.microsoftdev.com For detailed information on ASP.NET Mobile controls: For detailed information on ASP.NET Mobile controls:
www.asp.net/mobilewww.asp.net/mobile For detailed information on Tablet PC development: For detailed information on Tablet PC development:
www.tabletpcdeveloper.comwww.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: For technical information and downloads: msdn.microsoft.commsdn.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 with Mobile2Market, visit www.microsoft.com/mobile/mobile2marketwww.microsoft.com/mobile/mobile2market
Thank You!Thank You!