My weirdest bugfix

Last week I fixed a bug by adding a splash screen to DVD Maker. Well, I'm not sure you can really call it a splash screen, since it's only 10x10 and it only shows up off-screen, but it's still a splash screen, at least in concept.

The bug was related to how DVD Maker starts. If you have had the opportunity to run DVD Maker, you may have notice that it has a propensity to launch underneath underneath other windows. This happens because of a weird limitation in wizards, a weird layout manager, and weirdness between windows versions.

Our group uses a dialog layout technology to handle layout out our dialog controls. For a normal app, it's pretty simple, but wizards have this strange limitation - the wizard size is set based on the size of the first page, and you can't change it. So, if you have multiple pages of different sizes, you need to run layout on all of them to figure out a size that works for all of them, and then use that size.

Our framework does this by creating a temporary dialog, loading a wizard page into it, running the layout code, and then saving the size. Do this for all the wizard pages, and you're golden.

Which works great on Windows XP. But on Vista, something that changed, and when you destory that first temporary dialog, the system says, "Hey, that application has no active windows. We better make somebody else the active window". So, it chooses an application, and your wizard window now comes up behind that application.

At least, it does that sometimes. Sometimes it works.

The fix is to have another window that can keep your app the active one when you destroy the temporary. In other words, the aforementioned splash screen. Add one of those, and things are just peachy.