Friday, November 2, 2007

Using the Device Emulator

A PDA is a great device if you want to run a Guineu application on the Windows Mobile platform. However, development isn't that easy since you have to permanently copy files to the PDA every time you made a change to the FXP file.

Microsoft's Device Emulator makes this task much easier. There are two ways to get the Microsoft Device Emulator on your computer:

The easy way. Install Microsoft Visual Studio 2005 Standard or any of the higher levels. They come with the Device Emulator. You can use the Microsoft Download page to obtain updates and new images.

The hard way. If you don't have Visual Studio, you can still install the Device Emulator. However, it's not as straight forward and you have less option. In particular, images for Windows Mobile 6.0 seem to be coupled to Visual Studio so that you cannot install them. The same is true for several other images that Microsoft offers for download.

Step 1. If you don't happen to have the Virtual Machine Network Driver for Microsoft Device Emulator installed on your machine, you need to install Microsoft Virtual PC 2007:

http://go.microsoft.com/fwlink/?linkid=46859

You can install Virtual PC 2007 inside a VMWare Workstation instance, but most likely you cannot install Virtual PC inside Virtual PC.

Step 2. Download Microsoft Device Emulator 2.0

http://www.microsoft.com/downloads/details.aspx?FamilyID=dd567053-f231-4a64-a648-fea5e7061303

Step 3. Install the Device Emulator by executing vs_emulator.exe and following the setup instructions.

Step 4. Download the Microsoft Windows Mobile 5.0 image for Device Emulator. You need to download EFP.MSI (57.0 MB) from the following web site

http://www.microsoft.com/downloads/details.aspx?FamilyId=C62D54A5-183A-4A1E-A7E2-CC500ED1F19A

Step 5. Execute the EFP.MSI setup. When you are done, you can run the emulated devices from Start > All Programs > Microsoft Windows Mobile 5.0 MSFP Emulator Images. The first time you have to pick one of the Coldboot files.

Step 6. Use File > Configure… to change the configuration of your simulated PDA. Foremost you want to specify your development directory as a Shared Folder. This maps the folder as a Storage Card on your PDA.

Step 7. Install the latest version of the .NET Compact Framework 2.0 on the new PDA as outline in the documentation. The version you install on the PDA must be the same that you installed on your desktop. You can use the shared folder to transfer files from the Desktop PC to the PDA.

Step 8. Use GuineuIDE to compile your project into a Windows Mobile application. Then open the Storage Card in File Explorer on the PDA. Locate your project directory and click on the application. You can tell the application from the little icon in front of it as file extensions are hidden on the PDA.

When you close the emulator you are given the choice of saving the state. This produces a DESS file in the Device Emulator directory (by default C:\Program Files\Microsoft Windows Mobile 5.0 MSFP Emulator Images). You can copy the DESS file into your project folder and name it like the project. If the project is Sample.PJX, name the DESS file Sample.DESS.

When GuineuIDE finds a DESS file with the same name as the PJX file, it automatically opens Device Emulator with this Stored State file. Assuming that you configured the Shared Folder to be your project directory, this allows you to quickly debug your application on the PDA. DBF files can be opened in VFP and on the PDA at the same time. Only when you build a new Windows Mobile EXE, you need to terminate the EXE on the PDA. You don't have to shut down the Device Emulator, though.

No comments: