C# - 系统是/否值 [英] c# - Yes / No value of System
本文介绍了C# - 系统是/否值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法,我可以得到是/ .NET Framework中没有系统语言的价值?
Is there a way I can get the Yes / No value of the System Language in the .Net framework?
我不希望使语言文件每一种语言时,我只需要是&放;没有...
I don´t want to make language files for each language when I only need Yes & no...
谢谢!
推荐答案
从来就发现解决办法:
class Program {
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int LoadString(IntPtr hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax);
[DllImport("kernel32")]
static extern IntPtr LoadLibrary(string lpFileName);
static void Main(string[] args) {
StringBuilder sb = new StringBuilder(256);
IntPtr user32 = LoadLibrary(Environment.SystemDirectory + "\\User32.dll");
LoadString(user32, 805, sb, sb.Capacity);
YES = sb.ToString().Replace("&","");
LoadString(user32, 806, sb, sb.Capacity);
NO = sb.ToString().Replace("&","");
}
public static string YES;
public static string NO;
}
这篇关于C# - 系统是/否值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文