Today I finally found and fixed the root cause for a lot of problems with the MFC-UI I had in the last years. There always was something strange going on, I somehow had two MFC-contexts, one from the application, the other from the DLL. It often caused problems and I did a lot of workarounds with time.
The main reason for the problem was, that I use MFC in a very unusual way. Nearly all MFC specific parts of the program are in a separate DLL, the model and the rest, even most of the UI code connects to it over some class factories, abstractions and a powerful application specific UI-toolkit. This design has proved to be very powerful, nothing in the model has any direct connection to a UI so I could for example link my model implementation directly to a web server if I wanted to. There wouldn't be any problem to write a rudimentary UI in HTML/Javascript and connect it. So allowing simple geometry manipulation via a web interface.
But that way to use MFC is very far from normal use and so I sometimes have to dig quite deep to actually get things working and often even deeper to disable automatisms of MFC. E.g. my accelerator work was a good example, a normal MFC application doesn't even notice that it is there, it is simply automatically done.
I for some time had thought, that the reasons I had problems was, that I had to put the main object (CWinApp) into the executable, while all the rest of the code was in a DLL. The two contexts were obviously connected to those two. But I didn't understand how that could happen. So I tried to move the application object to the DLL and it quickly failed in a way I was quite sure I wouldn't be able to fix.
So I today decided to find out, what was going on. The first thing I noticed was, that my UI-library wasn't a MFC-extension DLL at all, but a DLL using MFC in a shared library. As soon as I tried to make it into an extension DLL I got linker problems. It turned out, that I had used a function which will make it impossible to create an extension DLL (AfxGetStaticModuleState). So I removed that and added some more code for things I had done wrong (dialog boxes needed an instance handle and used the wrong one) and now it works.
So after some years I have finally solved a big issue which had plagued me for some years.
And so August has now also passed and most of the list stayed intact. But I am still quite happy with all the stuff I have done last month. A lot of progress and I am nearer to finish some of the items on the list.Review of AugustThe month started wi
Tracked: Sep 01, 21:29