/* Layout change code concept by Baruch Rutman peterooch~AT~gmail~DOT~com Needs to be included for SetProcessDefaultLayout, GetUserDefaultUILangauge and for SetLayout Mostly recommended to be added before any window drawing!!! maybe can get added to the winnls.h,wingdi.h or something else, the language detector works great, the functions need some refinement. sources: locale identifiers http://msdn.microsoft.com/en-us/library/dd318693(v=vs.85).aspx GetUserDefaultUILanguage http://msdn.microsoft.com/en-us/library/windows/desktop/dd318137(v=vs.85).aspx mirroring awareness http://msdn.microsoft.com/en-us/goglobal/bb688119 */ #include int rtl; rtl = 1; // get locale information switch(GetUserDefaultUILanguage()) { case 0x1401: //arabic (all dialects) case 0x040D: //hebrew case 0x0820: //urdu (pakistan) case 0x0429: //farsi (persian) (iran) case 0x0478: //yiddish ( jewish german dialect ) case 0x045A: //syriac case 0x0465: rtl = 0; //dhivehi (maldives) break; default: break; } //set rtl layout if rtl language found above if (rtl==0) { SetProcessDefaultLayout(LAYOUT_RTL); } //works on "welcome", works only on the first window, dialogs aren't affected // Window rendering starts here... /* or else */ //function mode int RTLayout(void) { int rtl; rtl = 1; // get locale information switch(GetUserDefaultUILanguage()) { case 0x1401: //arabic (all dialects) case 0x040D: //hebrew case 0x0820: //urdu (pakistan) case 0x0429: //farsi (persian) (iran) case 0x0478: //yiddish ( jewish german dialect ) case 0x045A: //syriac case 0x0465: rtl = 0; //dhivehi (maldives) break; default: break; } //set rtl layout if rtl language found above if (rtl==0) { SetProcessDefaultLayout(LAYOUT_RTL); } }; // SetLayout SetLayout(HDC_of_somekind, LAYOUT_RTL); // the hdc thing drives me nuts! it's something about device contexts...