Creating CF Applications and Integrating a Smart Device Emulator with Delphi - Setting up the Emulator
(Page 2 of 4 )
An emulator for another OS typically requires a binary image of the OS which is to be emulated. The smart device emulators available for download from the Microsoft website are packaged with binary images of Windows CE and Windows Mobile OS, but you will be able to download additional binary images if you look around. MSDN offers downloads for different types of emulators; I am providing some of the links. Download the ones you want, as I have said before you can download addition OS images to work with one emulator executable:
You would also need to download and install the Virtual Machine Network Driver for Microsoft Device Emulator to be able to connect to the host machine or LAN from within the emulator.
The Virtual Machine Network Driver allows the Device Emulator to emulate its own network connection using the physical network interface on the host machine. I personally prefer connecting the Device Emulator to the host PC using the VMNet driver rather than using "ActiveSync over DMA" method.
Additional downloads include SDK For Windows Mobile 2003-based PocketPCs
After downloading and installing it using the default settings on my Microsoft XP 2002 desktop, the Emulator program is installed in "C:Program FilesWindows CE 5.0 EmulatorEmulator_500.exe" and the OS image can be found at the following two locations (since I have installed two binary images):
"C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Emulation\PPC_2003_WWE.bin"
and "C:\Program Files\Pocket PC 2003 Second Edition Emulators\WWE\Pocket_PC\PPC_2003_SE_WWE.bin"
These are the two locations where the image files are installed by default but they can be stored in any location, provided the emulator program is able to find them. To start the emulator from the command line we need to specify a binary OS image file followed by the parameter /sharedfolder <local folder> /video <resolution> /skin <xml skin file>
"C:\> < Path to the Emulator> <Path of Binary Image> /<SharedFolder> /<Video> /<Ethernet> /<Skin>"
The command line parameters are necessary to get the emulator to behave properly so let us take a closer look at them.
/Sharedfolder - This parameter can be used to specify a directory in the local file system which the emulator will treat as its Storage Card. In the absence of a hardware connection this directory can be very useful when transferring files from a PC to the emulated device. While this directory will be considered a shared folder by Windows, the emulator considers it to be its storage card.
/video - This parameter is necessary to set the screen dimensions and the screen resolution of the emulator. You need to specify the width, height and bit depth of the emulated devices' screen. If you are developing games or applications with graphics you would definitely like to see it as it would appear on the device itself. To get that effect, use the video parameter to set the screen width, height and color depth of the emulator screen to correspond to that of the targeted device. For instance, to make the emulator look like a Pocket PC you would have to set the width to 240, height to 320 and color depth to 16 by typing 240x320x16 after the "video parameter."
/ethernet - Specifies the level of networking support in the emulator; it is an optional parameter.
/skin- This too is an optional parameter that recreates the look of the phone/device it is emulating. It does look cool when you are testing in a window that looks exactly like your smart device as opposed to testing in a normal window.
After adding the path to the binary image to the command line and specifying the parameters, the command line on my screen looks like this:
C:\>"c:\Program Files\Windows CE 5.0 Emulator\Emulator_500.exe" "C:\Program Files\Pocket PC 2003 Second Edition Emulators\WWE\Pocket_PC\PPC_2003_SE_WWE /sharedfolder e:\WinMobileShared /video 240x320x16 /skin "C:\ Program Files\Pocket PC 2003 Second Edition Emulators\WWE\Pocket_PC\PPC_2003_SE.xml"
If correctly configured, you should now be able to launch the Emulator for Pocket PC 2003 SE, which looks something like the following:

Except for call-related functionalities it offers all the other functions of the Windows Mobile 2003-based Pocket PC or Windows CE depending on the OS binary image you have specified. However, if you are using a proxy then it would be necessary to configure the proxy settings in order to access the Internet or Local Area Network. This can be done by starting Internet Explorer on the emulator and selecting Internet Options from the Tools Menu. This would pop up a tabbed dialog box; select the "Connections" tab, click on "LAN" and enter the IP address of the server and the port number.
Next: Integrating the Emulator with the Delphi IDE >>
More Delphi-Kylix Articles
More By Danish Ahmed