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 6026501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:27:15+00:00 2026-05-23T04:27:15+00:00

On Win 7, MessageDlg shows information icon instead of confirmation icon (question mark). Here

  • 0

On Win 7, MessageDlg shows information icon instead of confirmation icon (question mark).
Here is the code:

MessageDlg('Are you sure you want to delete this file?'+ CRLF+ FileName, mtConfirmation, [mbYes, mbNo], 0)= mrYes

What am I doing wrong?

  • 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-23T04:27:16+00:00Added an answer on May 23, 2026 at 4:27 am

    First, notice that a simple workaround is to use the Windows API MessageBox function instead:

    MessageBox(Handle, 'This is a test.', 'Test', MB_ICONQUESTION or MB_YESNO)
    

    MessageBox

    But why doesn’t MessageDlg work? Well, MessageDlg does one of two possible things. It uses the Windows Vista+ Task Dialog, if possible, that is, it the OS is Windows Vista or later and themes are enabled and the UseLatestCommonDialogs global variable is true (the default). If not, the VCL actually creates a custom TForm and adds all buttons, labels, and icons manually (which is a bit odd if you ask me — why not simply use MessageBox?).

    The last approach supports the question-mark icon. Indeed, try

    UseLatestCommonDialogs := false;
    MessageDlg('This is a test', mtConfirmation, [mbYes, mbNo], 0);
    

    MessageDlg

    But this looks so ugly! Please don’t do this! It is stupid to create a custom message dialog instead of using the native OS dialogs!

    Unfortunately, however, the Task Dialog does not support the question-mark icon (as a pre-defined icon). This is not a restriction of the TTaskDialog wrapper, but a limitation of the Windows Task Dialog API. See the official documentation, for instance. There are TD_ERROR_ICON, TD_WARNING_ICON, and TD_INFORMATION_ICON, but no question-mark icon.

    Of course, the Task Dialog can use any icon. For instance, you can do

    if (Win32MajorVersion >= 6) and ThemeServices.ThemesEnabled then
        with TTaskDialog.Create(Self) do
          try
            Caption := 'Test';
            Title := 'Test';
            Text := 'This is a test.';
            CommonButtons := [tcbYes, tcbNo];
            CustomMainIcon.ReleaseHandle;
            CustomMainIcon.Handle := LoadIcon(0, IDI_QUESTION);
            Flags := [tfUseHiconMain];
            Execute;
          finally
            Free;
          end
      else
        MessageBox(Handle,
                   'This is a test.',
                   'Test',
                   MB_ICONQUESTION or MB_YESNO);
    

    Notice that I fall back on the old MessageBox should the Task Dialog API not be available.

    Task Dialog

    In principle, the MessageDlg function could use additional logic to handle the question-mark case separately, in a way that differs from the information, warning, and error cases. This would have made the mtConfirmation give the right icon even with the Task Dialog, at the expence of slightly more complicated, and less elegant, VCL code. Apparently, however, Embarcadero chose the simpler alternative of simply pretending that you asked for the information icon.

    Still, I wonder why Microsoft chose not to include a TD_QUESTION_ICON constant in the API. Perhaps this icon is discouraged in their latest UI guidelines?

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

Sidebar

Related Questions

how can i connect win nt sqlexpress? i am using this code to connect.it
I developed a win forms app targeting .net 2.0. All of this is in
I've got win service, which I want introduce in all my products. So how
Win-XP / Excel 2003 / VBA .... I have the following piece of code
I'm on Win XP but this problem occurs on Firefox, IE, and Google Chrome.
hi the win mobile 6 code tries to write files on network shared folder,
I am working on win application using c#, I want to send Ctrl +
I want in the win Application (written in C#), the sound (Wav Format) play
On OS from win 2000 or later (any language) can I assume that this
On Win Server 2008, I can execute the code below, and when I try

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.