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.

Comments (6)

  1. PatriotB says:

    A "dialog layout technology"… that wouldn’t happen to be DirectUI would it?

    Man.  More and more parts of Vista are using it.  And third-party developers are jealous that it isn’t documented and available for us to use.

    IE7 Beta 1 used it for drawing the tab interface.  Since that was against the DOJ consent decree (using an undocumented API), they changed it.  Now, it doesn’t link to DUSER the DLL; it looks like they took the DUSER source code and put it in their own DLL, IEUI.DLL.  If that isn’t an example of MS following decrees "to the letter" but going blatantly against their "spirit", I don’t know what is…  It certainly isn’t a level playing field since other browser makers don’t have access to DUSER’s source code.

  2. ericgu says:


    It actually isn’t DirectUI. Because of scheduling and dependency issues, we elected to use the same layout techonology that MovieMaker uses, which (delta this bug) seems like it was the right choice to make.

    But it’s not as new and snazzy as DirectUI.

    I can’t really comment on the accessibility of DirectUI to people outside of MS, other than to note that I’m a firm believer in making things easy and productive for developers.

  3. Alex says:


    That’s like saying "I like puppies!" — it’s a given. 🙂

  4. ericgu says:


    I wish you were correct, but I’ve run into more than a few people who don’t approach things that way…

  5. James says:

    Erm… why create a fake window instead of addressing the timing issue by creating the "real" Wizard before destroying the size-calculating dialogue. Also, why isn’t the temporary dialogue hidden, or else why does the window manager not ignore hidden windows?

    (I don’t like puppies)

  6. ericgu says:


    The temporary window never shows up. The layout happens in ONINITDIALOG (IIRC), and that’s where it’s destroyed.

    As for the first question, there are a lot of cans of worms there. To do what you suggest, I’d have to keep at least one of the 7 windows around, but I’d need to move them off-screen, because otherwise they’d show up (well, I guess I could make them invisible).

    To do that would be a major re-architecting of how our wizard sizing is done, and a lot more bookkeeping. Even given lots of time, I’m not sure whether I think that’s a good change, but on a product that’s past beta (to us) and we’re trying to shut down, we can’t afford that kind of churn.

Skip to main content