[Delphi] 设置线程区域语言防止乱码

uses
  Windows;

在工程文件中添加一句代码,如下:

  Application.Initialize;
  //添加以下一句解决外文系统乱码问题
  SetThreadLocale(DWORD(Word(SORT_DEFAULT) shl 16) or
      DWORD(Word(SUBLANG_CHINESE_SIMPLIFIED) shl 10) or
      DWORD(Word(LANG_CHINESE)));  
  Application.CreateForm(TForm1, Form1);
  Application.Run;

 

感谢 漠北 !

posted @ 2017-04-05 10:52  我爱我家喵喵  阅读(815)  评论(0编辑  收藏  举报