zoukankan      html  css  js  c++  java
  • C# 获取Windows语言类型(两种方式)

     1 //Windows XP 简体中文测试的结果,涂聚文注.
     2 
     3 using System.Runtime.InteropServices;//第一种API方式
     4 
     5 
     6 //API方式:
     7         [DllImport("kernel32.dll", EntryPoint = "GetSystemDefaultLangID")]
     8         public static extern int GetSystemDefaultLangID();
     9 
    10         [DllImport("kernel32.dll", EntryPoint = "GetSystemDefaultLCID")]
    11         public static extern int GetSystemDefaultLCID();
    12 
    13         [DllImport("kernel32.dll", EntryPoint = "GetOEMCP")]
    14         public static extern int GetOEMCP(); 
    15 
    16             int lc = GetSystemDefaultLCID();
    17             Response.Write(lc.ToString() + "<br>");//2052         
    18             int oem = GetOEMCP();
    19             Response.Write(oem.ToString() + "<br>");//936                
    20             int   languageint   =   GetSystemDefaultLangID();
    21             Response.Write(languageint.ToString());//14682116
    22 
    23 //
    24            using System.Globalization;//第二
    25             Response.Write("<br/>操作系统:");
    26             Response.Write(System.Globalization.CultureInfo.InstalledUICulture.NativeName.ToString() + "<br>");//操作系统:中文(中华人民共和国)
    27             Response.Write(System.Globalization.CultureInfo.InstalledUICulture.LCID.ToString() + "<br>");//2052
    28             Response.Write(System.Globalization.CultureInfo.InstalledUICulture.ThreeLetterWindowsLanguageName.ToString() + "<br>");//CHS
    29             Response.Write(System.Globalization.CultureInfo.InstalledUICulture.ThreeLetterISOLanguageName.ToString() + "<br>");//zho
    30             Response.Write(System.Environment.OSVersion.ToString() + "<br>");     //Microsoft Windows NT 5.1.2600 Service Pack 3
  • 相关阅读:
    JAVA_WEB--jsp概述
    npr_news英语新闻听力——每日更新
    词根词缀高效背单词技巧--词霸天下完整版
    python刷LeetCode:1071. 字符串的最大公因子
    python刷LeetCode:1013. 将数组分成和相等的三个部分
    python刷LeetCode:543. 二叉树的直径
    python刷LeetCode:121. 买卖股票的最佳时机
    python刷LeetCode:38. 外观数列
    python刷LeetCode:35. 搜索插入位置
    python刷LeetCode:28. 实现 strStr()
  • 原文地址:https://www.cnblogs.com/geovindu/p/2023480.html
Copyright © 2011-2022 走看看