I've been enjoying working on the new, more, umm, "modern" looking pTravelAlarm lately. One of the fun things about opening up development on new versions of applications is that you tend to get a flood of suggestions, and since development is open, you tend to implement them ;-)
A repeated request is to allow the user to change the color of the text on the screen. This would, of course, be trivially easy if we were using text exclusively, but a lot of what you see is actually bitmaps.
In actuality, mapping a color in a bitmap to another color isn't all that hard either - although certainly more difficult that simply setting the color of a piece of text, since it involves modifying the actual RGB values in the bitmap. Luckily I had a piece of code lying around from Phone Today, which has the need to map its icons to the Windows Mobile Today Screen theme color.
The code to do the colorizing is presented below for those who might have the need to do something like this. Basically the LoadAndColorizeBitmap method does the actual loading of the bitmap resource as well as mapping one particular color to another.
All of the bitmaps which will have their color changed are saved using a particular color (yellow, in my case). When the Windows Mobile application starts and loads the required bitmaps, it calls LoadAndColorizeBitmap, passing in the resource id and the requested color. LoadAndColorizeBitmap loads the bitmap and changes the color, returning a normal HBITMAP handle to the caller. No further work is required (except, of course, to call DeleteObject when done with the bitmap).
I only had the need to map yellow to something else, so you'll see #define statements for the red, green and blue values of the source color, but the function could be generalized if necessary.
The code