Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 489305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:47:41+00:00 2026-05-13T01:47:41+00:00

I have noticed a strange piece of behaviour when using MessageDlg and attempting to

  • 0

I have noticed a strange piece of behaviour when using MessageDlg and attempting to close my application via the Taskbar close all/group command.

My application is as follows:

  1. There is a hidden main form which doesn’t do anything other than handle some Windows Messages and pass them onto the child windows (if necessary).
  2. Each child window has its parent set to the desktop (in order to get it displaying on the Taskbar).
  3. Each child has an OnClose event which pops up a MessageDlg to prompt the user whether they want to save their session (if any content has been modified in anyway)

The issue seems to be it will continually close any windows that haven’t been modified, however, when it hits a window that has been, 1 of 2 things are happening intermittently:

  1. Regardless if I select “Yes/No” the Close All process seems to stop after that particular window is closed.
  2. The dialog is not displayed and mrCancel is the result. Again the close all process stops after this window is closed.

A change I made was to use the WinAPI MessageBox function in replace of MessageDlg and this did seem to resolve the issue. However, I would really like to know why MessageDlg is acting like this?

My initial thought was when the dialog is being launched in the middle of the Close All perhaps the OS is sending a WM_CLOSE message to the dialog as it is technically part of the group (this would explain the dialog not appearing and defaulting to mrCancel as this is the equivalent of pressing the X). However, that doesn’t explain why after I dismiss the dialog the Close All process does not continue to close any other windows in the group!

Any thoughts/idea’s on this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:47:42+00:00Added an answer on May 13, 2026 at 1:47 am

    Windows doesn’t send WM_CLOSE messages to these windows, it posts WM_SYSCOMMAND with the SC_CLOSE request. This in turn leads to the sending of WM_CLOSE messages if the standard Windows message box is used. If the MessageDlg() function is used instead, only the first posted WM_SYSCOMMAND leads to a WM_CLOSE, the others do not. It’s hard to say for sure, but maybe this has something to do with the DisableTaskWindows() and EnableTaskWindows() calls that the VCL uses to “fake” modal dialogs. If you replace the Windows function with Application.MessageBox(), a wrapper that does use DisableTaskWindows() and EnableTaskWindows(), then it doesn’t work either (which IMO supports this reasoning).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have noticed a strange behaviour when using the command functionality in Silverlight: When
after adding adMob ads to my application, I have noticed some strange memory behaviour.
I am using FileWriter and I have noticed strange behavior. I buffer my collection
I have just noticed a strange behavior of ComboBox component. I am using it
I have noticed a strange behaviour when intercepting the preUpdate row hook in Propel
I am creating a responsive website, and have just noticed a strange behaviour in
I have noticed a strange behaviour of FULL OUTER JOIN in Oracle 11. I
I'd noticed a strange behaviour of jquery.height() function. Have a look at the following
I am using SQL Server 2005 and I have noticed something strange when I
I have datagrid and noticed strange bug: I set HeadersVisibility=All. And when move mouse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.