Creating CF Applications and Integrating a Smart Device Emulator with Delphi - Integrating the Emulator with the Delphi IDE
(Page 3 of 4 )
Now that we have managed to configure a standalone emulator, let us see how we can integrate it with the Delphi IDE with the help of some third party tools.
Jeremy North has developed a cool plugin called Compact Framework Builder Helper (CFBH) to integrate the emulator with the Delphi IDE. Download CFBH and run the setup process; it is pretty plain and simple like most installations. However, if you wish to add new menu items to the Delphi IDE you need to make certain you select the option to create new menu items from the settings option during the installation.

[CFBH ScreenShot1]
Then comes the emulator part. Here you need to select the path of the emulator program and the OS image that you wish to emulate. You can have multiple emulators if you provide the program with multiple OS images, however, each emulator has to be created separately. The shared folder path points to the location/directory that is treated as the storage card by the emulated device. Files can be transferred from the PC to the emulator and vice versa by moving them to the folder considered by the emulator to be the storage card.

[CFBH ScreenShot2]
You can also control how the emulator is displayed by selecting the "Display" option and then choosing a skin (xml) file or setting up the screen resolution.

[CFBH ScreenShot3]
If you have checked the Auto Fix Errors checkbox from Folder Options then you need to download Chee Wee Chua's Compact Framework Project Preprocessor (MakeCFCompatible) and provide the path to the executable. This is another great tool that parses through your code and comments out methods and properties not supported by Compact Framework assemblies. However, it requires that you have the Delphi for .NET Compact Framework Compiler installed which is available to registered users only.
Once CFBH is installed and configured, fire up Delphi and you should be able to see a new menu item called "Compact Framework." The emulator is now available from Compact Framework|Emulators|<Emulator Name>; click on it to launch the emulator. You should be able to see the same emulator we configured as a standalone.
But CFBH offers more than that. Go to File Menu New|Others; a familiar dialog should pop up containing the project templates available. But now a new item named "Smart Device" is added which has two sub folders named "PocketPC" and "SmartPhone."

[CFBH ScreenShot4]
That's not all. Before you compile your CF application you need to be sure that the CF assemblies are installed on the desktop. The emulator we have set up should have Compact Framework installed on it; if you want to be sure just run cgacutil.exe and a message box displays the version of CF installed. You can copy the CF assemblies from the emulator to your desktop to extend support during compilation. Use the Storage Card to copy all the dlls with the 'GAC_' prefix and then rename them removing the 'GAC_' prefixes. You can later reference these assemblies from your program. Marc Rohloff explains this in detail in his article Getting Started with C# and the Compact Framework by Marc Rohloff
You are now ready to build an application for your PDA/SmartPhone. The CompactFramework Menu in Delphi IDE allows you to build and test your applications with your smart device emulator.
Next: Creating a CF application from within the Delphi IDE >>
More Delphi-Kylix Articles
More By Danish Ahmed