Ingredients

A copy of Delphi 2006 (that is, Borland Developer Studio 2006) and a PocketPC device or a PocketPC emulator.

Steps

1. Create a new WinForm application in Delphi 2006: File -> New -> Windows Forms Application – Delphi for .NET

2. Add a button to its form

3. Click on the button and add an event handler, like: MessageBox.Show('hello');

4. Change the project search path to refer to the CF assemblies: Project -> Options, go to the Directories/Conditionals page, replace the Search Path with "C:\Program Files\Borland\BDS\4.0\lib\cf" (or similar, depending on your installation).

5. Build, and you'll get errors for the 6 lines of code with properties/methods not supported by CF. Delete those lines (SuspendLayout, Name x 2, TabIndex, AutoScaleBaseSize, ResumeLayout).

6. Build again. Error in the project file on the threading model. Delete the line with "[STAThread]".

7. Build again.

8. You can now copy the resulting executable file to your PocketPC device, or move it to the shared folder of the emulator. It will work.

9. Add one line of code to the form constructor (Self.MinimizeBox := False;) to close the application automatically, otherwise deploying a new version will become complex, as you'll have to terminate the program from the PocketPC Control Panel.

Moral of the Story

Repeat with me: You don't need to use the command line, you don't need to use the command line, you don't need to use the command line, you don't need to use the command line, you don't need to use the command line...

Now you might wonder why I'm underlining this. The reason is that there is a BDN video by Tim Jarvis of Borland that implies you have to use the command line compiler unless you want to install third party tools in the IDE (the video "provides the rudimentary steps of setting up and performing CF development with Borland Developer Studio 2006" ). However, this is not the case. Delphi works better than Borland is telling the world and this is a pity. The video shows an unnecessarily complex approach.

Not only you can compile CF apps from the IDE, but after you change the Search Path, close and reopen the project, the Code Insight features (like Error Insight) will work against the CF assemblies. This means you'll be able to see coding errors like those introduced by the WinForms designer (and described earlier) directly in the editor even without compiling!

PS. I did get in contact with some people at Borland mentioning the problem but I didn't receive a positive reply.