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

1 answer

Sort by: Oldest
  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?

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.