Microsoft KB Archive/250276

From BetaArchive Wiki
Knowledge Base

How To Do Right-to-Left and Left-to-Right Mirroring in Windows 2000

Article ID: 250276

Article Last Modified on 3/1/2007


  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional Edition
  • Microsoft Platform Software Development Kit-January 2000 Edition

This article was previously published under Q250276


On a Windows 2000-based computer, you can dynamically change the application user interface from left-to-right to right-to-left.


This can be accomplished by using the following code:

  // Use ANSI versions of GetWindowLong() and SetWindowLong() because 
            // Unicode is not needed for these calls.
            lExStyles = GetWindowLongA(hWnd, GWL_EXSTYLE) ;

            // Check whether new layout is opposite the current layout.
            if(!!(pLState->IsRTLLayout) != !!(lExStyles & WS_EX_LAYOUTRTL)) 
               // The following lines update the application layout to 
                // be right-to-left or left-to-right, as appropriate.
                lExStyles ^= WS_EX_LAYOUTRTL ; // Toggle layout.

                SetWindowLongA(hWnd, GWL_EXSTYLE, lExStyles) ;
                // This is to update layout in the client area.
                InvalidateRect(hWnd, NULL, TRUE) ;


Keywords: kbbidi kbhowto KB250276