`
`EVisuALPiiouiAMiui
`
`GEORGE SHEPHERD AND SCOT WINGO
`
`mg to download every time to a real Windim-s (Il‘l~ll.‘l~l‘(l
`device. Of course. to make sure your uppllt'ullolls \\ ork eur-
`rectly you still need to test with real (lt'Vlt‘t's. but the man
`lator takes much ofthe pain out ol‘ the earli- debugging
`‘ stages. Figure 2 shows the emulation em Ironnii Ill
`Four Windows(‘ E--specil'it App“ wards ship \\ illi \ no. ll
`C++ for Windows (‘ E:
`
`‘
`he first round oftools for Windows® CE 2.0 is out,
`and this month we take a look at Visual C++®for l
`Windows CE 2.0. In addition to introducing you to
`the Windows CE development environment, we’re going to
`port a freeware MFC-based grid control to the environment
`to show what you face in portng your MFC applications to
`Windows CE.
`
`° WCE ATL COM AppWizartl
`° WCE MFC ActiveX ControlWizard
`' WCE MFC AppWizard 1 ”Ha
`' WCE MFC AppWizard (EXE)
`They are basically the same as their Win32 counterpart-i,
`except that they have different features that take .'|(I\.lll
`tage of the Windows CE operating system, such .i.». the
`- Windows CE help environment. Flam 3 show: .‘| page lrmn
`the MFC executable project with some Windows (‘1': upr
`3 cific options.
`
`
`
`The Development Environment
`Visual C++ for Windows CE is an add-on to Visual C++
`
`5.0. When you install the product, it extends Visual C++ by
`adding the following features:
`' An Intel-based Windows CE emulation environment.
`
`' New targets for each of the Windows CE-supported
`processors (MIPS/SH and the emulation environment).
`Figure 1 shows the new configurations and toolbars
`added by the environment.
`° New AppWizards for Windows CE-based applications.
`° A Windows CE-compatible port of MFC (version 4.20
`with some modifications).
`° A Windows CE-compatible port of ATL.
`Visual C++ for Windows CE 2.0 also supports
`the older 1.0 and 1.01 versions of Windows CE.
`
`3 Mini MFC
`
`The version ofMini MFC that ships mth the Visual l'. t
`for Windows CE 2.0 has many more features than the
`previous release of the toolkit. The previous \‘t‘rslnn sup-
`ported only a handful of the core classes. This has been
`expanded, and some new classes have been added abou-
`and beyond those available in the standard .\ll-'(‘ To get .-i
`‘ feel for which MFC classes are supported see "one. \\ hich
`is a hierarchy chart. The green items are not supported
`Three categories ofclasses have been added to Mini .\ll-‘('
`for Windows CE: command bars. object store. and socket
`classes. Command bars are a hybrid menu toolbar that Is
`part ofthe Windows CE common control library and \\ r.‘lp~
`
`;
`1
`
`Windows CE 08
`“It“ selector
`
`o
`
`L- _.. .
`
`.i.‘
`
`i.
`
`it-
`
`.
`-
`..i.... 1.1.:
`
`iELW\_
`:-
`r”31mg, i
`
`‘mzl *EWEthEMImu-ea
`Zia-L11] QC 4131’
`'_
`
`M
`.
`.
`3
`; WWW H_
`a. a... Iva—1M
`'
`3 til-«vh-
`
`FANDANGO EXHIBIT 1070
`
`,
`
`i
`
`
`
`.mp1:
`___-._._ .
`.Cmipiiing
`.» .-
`1‘ Calm”?
`7 333353”
`
`:iiiiigiihs
`l .sizvia- can
`t Generating "I
`l Linking
`[Error spawn 9
`'.532 ex: » 1.;
`ll [1 Md ('7.
`m
`Configuration selector
`(includes MlPS/SH/Emul)
`
`affix:
`32:“ch
`MFC Wan lat
`N‘C We“ I—l
`MEW
`hmm “:1“
`WEE MFC We'd l-l
`fififimfl'fi‘"‘
`
`
`
`Figure 1 Visual C++ for “’ilulott's ('I'.‘ 3.0
`
`WI)!
`
`This article focuses on the Windows CE 2.0 sup-
`port, but most ofthe features are also available for
`
`the earlier editions ofWindows CE.
`
`What’s New?
`Windows CE 2.0 adds many of the features
`missing from Windows CE 1.0 that make life
`easier for developers, such as COM and ActiveX”
`support and many of the Win32® APIs. These
`make the tools much more usable. In fact, Visual
`. 3
`-
`.
`’
`Bas1c“ now supports Wlndows CE, well take a
`look at that env1ronment 1n our next column.
`The Windows CE emulator is a really cool ver-
`sion of Windows CE that runs on your desktop. It
`gives you the convenience of being able to run and
`
`test your applications immediately without hav—
`George Shepherdis a Senior Software Engineer at
`Stingray Software where he develops Visual CASE for
`developers using MFC and OLE. Scot Wingo is cofounder
`OfStingray Software (www.3tingsoft.c0m), an MFC/Java
`class library company. George and Scot co-wrote MFC
`Internals (Addison-Wesley, 1996).
`
`FANDANGO EXHIBIT 1070
`
`
`
`
`
`
`
`0 Windows CE requires Unicode
`strings. The freeware grid does not
`use Unicode strings, so we had to
`convert them. This included using
`the_T() macros, switching to the
`Unicode declarations for strings,
`and so on. This was by far the
`largest problem and took a while
`to build and test. We decided to go
`ahead and get the Unicode builds
`up and running on Win32 and then
`test again on Windows CE.
`0 Many ofthe printing APIs used by
`the freeware grid (such as IsPrint-
`ing and BeginPrinting) were not
`supported by Mini MFC. We
`#ifdefed these printing APIs out
`until printing is supported.
`0 Property sheets are not supported
`in Windows CE. The freeware grid
`sample uses numerous property
`sheets so we had to remove these
`
`parts of the samples.
`° The freeware grid uses many cursor control samples
`that are not supported by Mini MFC. We disabled this
`functionality with #ifdefs.
`
`After working around these issues, we were able to get a
`clean compile of the freeware grid and its sample. Then we
`ran it to see how it performed under the emulator. It started
`to draw slightly and then immediately ASSERTed. When
`we dug into the code to find the cause of the ASSERT, we
`found that several of the font metric calls were failing. We
`couldn’t find a valid reason for the font metric calls to return
`
`NULLs, so we stubbed out the calls and put in hardooded
`values. This article was written with a beta version of
`Windows CE 2.0 as well as beta versions ofthe development
`tools, so this problem will most likely be fixed in the
`production versions of the OS and tools.
`The modified code that has been ported to work on
`Windows CE 2.0 is available from the MSJ Web site. MIN
`5 shows the control in action. The cursor handling still
`needs some improvement, but the control has largely the
`same functionality under Windows CE as it does under
`Win32.
`9
`
`IICIOOOFY
`IVIYIII
`JOURNAL
`mums.“
`
`ped by functions in the Mini MFC
`(‘ I-‘rameWnd class. The bars at the top
`of m 2 illustrate the typical Win-
`dows CE command bars.
`Instead ofImplementinga file meta-
`phor. Windows CE provides an object
`store instead. Several new MFC classes
`were added to give the developer access
`to the object store:
`0 (YCeDBllatabase encapsulates a
`database in the object store.
`0 (TCeIml'Inum enumerates the data-
`bases in the object store.
`0 (‘CeDBRecord provides access to a
`record in the database.
`
`0 (?(‘el)lil’rop encapsulates a data-
`base property. Database properties
`are data items that consist of an
`
`applicatIon-defmed property iden-
`tifier. a data type identifier, and the
`data value.
`lnadditimtotlmedatastoreclasses,
`II new class. C(‘eSocket. implements an
`asynchronous CSocket derivative.
`For more information on Windows CE and the various
`
`development
`windowsce.
`
`tools. see http://www.microsoft.com/
`
`Now that you've seen an overview of the Mini MFC, let’s
`put the environment through its paces by porting a project
`from Win32 to Windows CE.
`
`FI‘III'. 3 Windows CE-specific Options
`
`W UPC Apps to Windows CE
`To take the Mini MFC for a spin, we needed something
`larger and more complex than the Scribble sample. We
`decided to port a freeware MFC grid control written by Joe
`Wilcoxson that's available on the Internet at http'J/www.-
`users.aol.com/chinajoe.
`The first step was to convert the grid sample from an
`MDI application to an SDI application under Win32, be-
`cause Windows CE does not support MDI. This was a
`simple exercise of changing some base classes from MDI to
`the SDI equivalents and updating the creation of the
`document template.
`Next. we created a Windows CE debu confi
`ation f
`the project based on the Win32 projeci We :crommedd
`doing a firstpass Windows CE port under the emulator due
`to its faster edit/compiIe/debug cycle.
`Once you have your code working well
`under the emulator test it on the ac-
`tual target devices.
`After creating the Windows CE-
`based project. we kicked off a compile
`with fingers crossed There were liter-
`ally hundreds of errors caused due to
`the following reasons:
`
`
`
`Hon. 5 Windows CE 2. 0 Control
`
`To obtain complete source code listings, see the
`MSJ Web site at http:// www.microsofl.com/
`ms}.
`
`Have a question about programming in
`Visual Basic, Visual FoxPro, Microsoft
`Access, Office, or stuff like that? Send
`your questions via email
`to visuaL
`doveloporestingsoficomorsoorgosmilhfld
`at 70023.1oooecompusemcom
`
`
`
`