Last time, I left an exercise to determine why the TaskDialog function was not actually displaying anything. The problem had nothing to do with an invalid window handle parameter and had all to do with original window being destroyed.
My psychic powers told me that the window’s WM_DESTROY handler called PostQuitMessage. As we learned some time ago, quit messages cause modal loops to exit. Since the code was calling TaskDialog after the window was destroyed, there was a WM_QUIT message still sitting in the queue, and that quit message caused the modal loop in TaskDialog to exit before it got a chance to display anything.
Switching to MessageBox wouldn’t have changed anything, since MessageBox responds to quit messages the same way as TaskDialog.
(Worf was the first person to post the correct answer.)
0 comments