Developing Applications with eVC++ 4.0

Download Report

Transcript Developing Applications with eVC++ 4.0

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…
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.1
Enhancements









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)
The Right Tool…
eVC++ 3.0
 Windows CE 3.0based smart
devices
 Pocket PC
 Pocket PC 2002
 Smartphone 2002
eVC++ 4.0
 Windows CE .NETbased smart
devices
 Pocket PC 2003
Remote Tools
eVC++ 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 Tools
New with eVC++ 4.0

Remote Call Profiler



Kernel Tracker


“Testing Real-Time Systems in Windows
CE .NET” by Mike Hall and Steve Maillet
http://windowsfordevices.deviceforge.co
m/articles/AT2137345992.html
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)
Preprocessor
Precompiled Headers


Key Benefit - Faster Build time
Obstacles:



Understanding Setup
Automatic versus Manual
Establishing Default Settings
Precompiled Headers
Three Modes
Settings For: All
Configurations
Off
Auto
Manua
l
Precompiled Headers
The Meaning of “Through header”
Use
Precompiled
Headers Up
to and
including
stdafx.h
#include
#include
#include
#include
#include
"stdafx.h"
"propsip.h"
<commctrl.h>
<aygshell.h>
<sipapi.h>
Precompiled Headers
Setup for Manual Mode (1 of 2)
Select Source File
“Create
headers”
for one
source
file
Precompiled Headers
Setup for Manual Mode (2 of 2)
Select Source File
“Use
headers”
for all
other
source
files
Precompiled Headers
Default Settings
Select Project
Sets
default
for new
items
added
to
project
Preprocessor
Symbols








I486
WIN32
STRICT
USA
UNICODE
_UNICODE
_X86_
x86





UNDER_CE=$(CEVersion)
_WIN32_WCE=$(CEVersion)
_WIN32_WCE_EMULATION
INTLMSG_CODEPAGE
INTERNATIONAL
Preprocessor
Symbols (continued)

Windows CE Conditional Compilation


Targeting a Specific Version



#ifdef UNDER_CE
#if UNDER_CE == 300
#if UNDER_CE >= 211
Emulator-Specific Code

#ifdef _WIN32_WCE_EMULATION
Preprocessor
Symbols (continued)
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”
Compiler
Building 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
Compiler
Building 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
Compiler
Win32 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
Compiler
Win32 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, . . .);
}
Compiler
Win32 Message Cracker Macros (cont)

AFTER:
MyWindowProc(…) {
switch (msg) {
HANDLE_MSG(hwnd,WM_PAINT,OnPaint);
HANDLE_MSG(hwnd,WM_MOUSEMOVE,OnMove);
. . . }
void
/*
}
void
{
/*
}
OnPaint(HWND hwnd) {
WM_PAINT handling code */
OnSize(HWND hwnd,UINT state,int cx,int cy)
WM_SIZE handling code */
Compiler
Win32 Message Cracker Macros (cont)

The definitions:


#include <windowsx.h>
A Tool:
Email: [email protected]
For a complimentary copy
Linker
Where 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 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]
<Select Adapter>
[Name Servers]
Debugging via network
At Work (with DHCP)




Attach USB/serial cable
Enable DHCP on device
Attach network card/cable
Might need to reset device
Emulator
Tips for Setting Up

Operating System:



Communications:



Use Win 2000 sp2, or WinXP
Cannot use Win 9x/Me
Requires TCP/IP (Internet) Protocol
Machine Name must start with letter
Tip:


Login with Administrator privileges
Install Microsoft Loopback Adapter
Managed Code Projects
Adding 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: [email protected]



CRACKERS coding tool
CEFUN function viewer tool
Training / eCoaching for programmers
Your Questions…
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 info
www.mymsevents.com
Market Smartphone and Pocket PC applications to mobile operators
with Mobile2Market, visit www.microsoft.com/mobile/mobile2market
Thank You!