Sweet Salvation

DanG very kindly sent me some code for implementing the mysterious OLE IPicture functionality, and lo, I am now able to load jpeg and gif files!

To the right is a screen grab from my [dusty old] prototype HTML renderer, something which will maybe get incorporated into Book Reader at some point. Until now it was only able to display BMP format images, which as mentioned previously, is not the best file format around.

I really must spend some time getting to know OLE/COM/ATL… I think I was turned off a little early in my programming life by the lack of documentation for doing any OLE stuff without MFC.

What’s wrong with MFC?

To be honest I can’t give a definitive answer, except to say that for the most part MFC is just a bunch of C++ wrappers for the WinAPI, and maybe the WinAPI is not so scarey that it needs to be abstracted away to that degree. These days I generally like to avoid MFC so as to preserve an understanding of how things actually work.

I think I first lost patience with MFC when it came to the area of command routing, the method it uses for passing Menu/Hotkey messages around, and for updating the appearance of menu items (checked/disabled etc). This system worked great until you needed it to do something extra, or a little differently. I can’t remember the details but I did spend a long time banging my head against CCmdTargets and trying to work out how to automatically update the appearance of context menus [I am certain that there is a way, I just gave up before I found it]

I thought it was pretty silly that you had to manually put HotKey descriptions into your menu items, and I also thought it was excessive that every single command added a new function to the main window/application class (as well as an optional UpdateCmdUI function).

Most occasions that MFC would cause a problem for me, the nature of the problem had to do with the fact that MFC was hiding Win32 functionality from me, and had I understood the Win32 functionality in the first place then the problem would have either never occurred or been easily rectified. Once again I refer you to the wisdom of Joel Spolsky, and his article The Law of Leaky Abstractions.