A customer reported a problem with the TaskDialog function.
We’ve encountered a strange behavior in the
TaskDialogfunction. A user reported that when exiting our application, our program played an error beep that didn’t appear to be associated with an error. After investigating, we found that the sound is coming from our application trying to display an error dialog before closing by callingTaskDialog. The error beep is played but no dialog appears.Some background on the error condition that we’re trying to report: We’re calling
CreateWindowEx, and the window procedure creates another window in itsWM_CREATEhandler. It looks like the original window is destroyed beforeWM_CREATEis finished, soCreateWindowExreturnsERROR_INVALID_WINDOW_HANDLE. It’s not clear why this is causingTaskDialogto fail, but this is the only scenario where we see this behavior. All other calls toTaskDialogwork as expected. We know how to fix the original problem withCreateWindowEx, but we would like to understand what’s going on withTaskDialogin case there’s another bug here.
With a little bit of psychic powers, you can solve this customer’s problem too.
(If you have a good memory, you may have noticed that it’s a variation on a previous puzzle. But I get to keep recycling it because every year, a new batch of developers stumbles across the problem.)
0 comments