Why does MB_RTLREADING mirror a MessageBox on my English Windows?

Rohan Pande 535 Reputation points
2026-11-27T13:05:18.75+00:00

Hi,

I'm showing an error with MessageBoxW and want it to look right for RTL Language users. The docs say MB_RTLREADING "Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems", so I assumed it would do nothing on an English system.

But on my English (India) Windows 11, adding MB_RTLREADING flips the whole box around: the icon goes to the right, the OK button to the left, and the close button to the left of the title bar. I attached a screenshot.

User's image

I'm a bit confused about a few things:

  1. What counts as a "Hebrew and Arabic system" in that sentence?
  2. Is it normal that the flag mirrors the whole box and not just the text order?
  3. What's the right way to decide when to pass it? Right now I check whether the user's UI language reads right to left and only add the flag then. Is that a sensible approach?

Thank you!

Windows development | Windows API - Win32

Answer accepted by question author
Nguyen Dam (WICLOUD CORPORATION) 1,830 Reputation points Microsoft External Staff Moderator
2026-11-30T04:34:06.6766667+00:00

Hello @Rohan Pande and thank you for reaching out. 

As you suspected, the flipped box is actually expected. MB_RTLREADING is a flag your application passes explicitly, and RTL layout in Windows mirrors the UI elements as well, not just the text. To address your questions: 

The system does not consider your text to be Hebrew or Arabic. More importantly, MB_RTLREADING does not depend on the language of the text or the system's display language. Once you pass the flag, the message box uses RTL presentation regardless of either. 

It is normal for the entire message box to be mirrored. In an RTL layout, the icon, buttons, and title bar controls are mirrored along with the text, as described in the documentation above. 

Adding the flag conditionally for RTL is indeed a sensible approach. You can also use APIs such as GetUserDefaultUILanguage to retrieve the user's UI language, or GetUserPreferredUILanguages to retrieve their preferred UI languages. Additionally, GetLocaleInfoEx with LOCALE_IREADINGLAYOUT can determine whether a particular locale uses RTL reading order. 
Each approach has its own trade-offs, so I suggest reviewing the relevant documentation to determine which best suits your application. Alternatively, a less error-prone approach would be to let users choose the language in your app, rather than assuming their preference based on Windows settings.

I hope this clarifies your question. And if you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation. Thank you. 

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. AI answer

    2026-11-27T13:06:23.73+00:00

    MB_RTLREADING should be treated as an explicit request to mirror the message box, so pass it only when the language of the message being displayed has a right-to-left reading layout.

    Why the entire box is mirrored

    This is normal Win32 behavior. The window-layout documentation explicitly says that message boxes do not inherit layout and that passing MB_RTLREADING is how an application mirrors one.^1^

    An RTL window layout affects more than glyph order: it can change the positions of icons, buttons, the coordinate origin, and other window elements.^1^ That accounts for the icon, OK button, and title-bar close button moving in the screenshot. Mirroring the surrounding UI is also the expected localization model for Arabic and Hebrew interfaces.^2^

    It does not reverse the characters in English text. Unicode bidirectional processing still keeps an English run left-to-right even when its containing layout is RTL.^3^

    What “on Hebrew and Arabic systems” means

    That phrase in the MessageBoxW flag table is misleading if read as a prerequisite enforced by Windows. The same documentation elsewhere describes MB_RTLREADING as the option used to mirror a message box, and the flag is honored even when the current Windows UI is English.^4^

    Do not use the Windows installation language to gate the flag. On current MUI versions of Windows, the install language has a limited role; applications can have user, process, and thread UI-language preferences that differ from it.^5^

    Base the decision on the actual localized resource language used for that message box:

    1. Determine which locale your resource-loading/localization layer selected for lpText and lpCaption.
    2. Query that locale’s LOCALE_IREADINGLAYOUT.
    3. Add MB_RTLREADING when the returned layout is 1, meaning right-to-left.^6^
    4. Optionally add MB_RIGHT when the message text should also be right-justified; it is a separate flag from RTL reading order.^4^
    #include <windows.h>
    
    bool IsRtlLocale(PCWSTR localeName)
    {
        DWORD layout = 0;
        int result = GetLocaleInfoEx(
            localeName,
            LOCALE_IREADINGLAYOUT | LOCALE_RETURN_NUMBER,
            reinterpret_cast<LPWSTR>(&layout),
            sizeof(layout) / sizeof(WCHAR));
    
        return result != 0 && layout == 1;
    }
    
    UINT flags = MB_OK | MB_ICONERROR;
    if (IsRtlLocale(activeResourceLocaleName))
        flags |= MB_RTLREADING | MB_RIGHT;
    
    MessageBoxW(owner, message, caption, flags);
    

    GetLocaleInfoEx supports numeric locale information through LOCALE_RETURN_NUMBER and returns zero on failure, in which case GetLastError provides the error.^7^

    Your current user-UI-language check is sensible if the application always displays resources in that language. If the application has its own language selector, uses thread/process preferred UI languages, or falls back to another resource language, test the language actually selected for the displayed strings instead. Otherwise, an Arabic UI preference combined with an English fallback message could produce exactly the mixed result shown: mirrored chrome around English text.


    References

    1. Window Features
    2. Mirroring
    3. Right-to-left language support and bidirectional text
    4. MessageBoxW function (winuser.h)
    5. User Interface Language Management
    6. LOCALE_IREADINGLAYOUT
    7. GetLocaleInfoEx function (winnls.h)
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.