【问题标题】:The best way to change system language c#更改系统语言c#的最佳方法
【发布时间】:2023-03-29 04:15:02
【问题描述】:

应用程序将由来自不同国家的用户安装,具体用户的键盘布局是什么语言是未知的。我们需要一种改变键盘布局的方法。

【问题讨论】:

  • 你知道语言和键盘布局不一样吗?

标签: c# winapi keyboard keyboard-layout


【解决方案1】:
    [DllImport("user32.dll")]
    public static extern IntPtr GetForegroundWindow();
    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    public static extern bool PostMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
    public void ChangeLanguage()
    {
        PostMessage(GetForegroundWindow(), 0x0050, 2, 0);
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-21
    • 1970-01-01
    • 2018-06-21
    • 1970-01-01
    • 2020-04-30
    相关资源
    最近更新 更多