Daily stuff not frequently posted a software developer finds out or rants about.

Saturday, July 08, 2006

Windows applications without a framework (and not even object orientation if not wanted)

When starting to write an application for Windows CE, I noticed a few things in the LCL (Lazarus Component Library) that were not yet perfect for modern CE devices, like the missing proper fullscreen mode: up to Windows CE 2.0, the start bar was at the bottom, afterwards it was moved to the top, but out of compatibility, developers have to tell the application that they want it the modern style (and if I remember FreePascal for arm-wince correctly, it creates code for Windows CE 3.0 and upper only anyway). So I had to add that code. And then there was the thing about the close button not working on first click, the window being movable and all that stuff.

So I went to the drawing board and started to create everything nearly like in the old Turbo Pascal for Windows days, using a message procedure and creating everything by hand using CreateWindowEx. For more details regarding the controls, including special Windows CE attributes (this example works on Windows 32 as well otherwise), take a look into the Windows Mobile SDK (or even better than that link, into the downloaded version, which you'll probably need to install for the emulator to be able to install anyway).

The results are very lightweight applications that don't even need object-oriented programming like shown in my simple demonstration application, available here; though I would recommend to capsulate the window and control creation at least, and for larger projects, classes do really make sense for creating code with a structure that's way more easy to read. Showing my whole framework unit that does this would have made the basics a bit more difficult to understand though ;)

0 Comments:

Post a Comment

<< Home