如何在Windows(c++)中更改语言键盘布局
How can change language keyboard layout in Windows (c++)
我需要更改键盘语言。有了这段代码,如果在焦点应用程序中,我可以更改语言:
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <string>
using namespace std;
#pragma comment(lib, "User32.lib")
int main(int argc, char *argv[])
{
//0409 - Ingles, 0c0a - Espanhol, 0416 - Portugues
char *str = "0c0a";//argv[1];
int i;
if(EOF != sscanf(str, "%x", &i))
{
SendMessage(GetActiveWindow(), WM_INPUTLANGCHANGEREQUEST, 0, i);
}
system("PAUSE");
return EXIT_SUCCESS;
}
但我肯定需要更改系统键盘语言,在应用程序关闭或如果未在应用程序中设置焦点。
有人能帮我吗?
如果确实需要更改用户的键盘布局,可以使用以下功能:GetKeyboardLayoutName()和LoadKeyboardLayer()。
相关文章:
- 物理键盘上的触发器按键
- 如何使用C/C++在MacOSX中获得键盘布局
- 不同语言中相同代码的不同行为
- 为什么C++对链表中的下一个节点使用指针,而像 C# 或 Java 这样的语言只使用类 Node 的名称?
- r语言 - C++ 类型为"const std ::?
- 通用C++/Python 多语言的存在
- 视窗键盘输入 c++
- 为什么我的 EnumWindowProc 不能用 C 语言编译?
- 了解算法的性能差异(如果以不同的编程语言实现)
- Rextester 语言编译C++问题
- 将鼠标和键盘输入发送到 unity3d 游戏 (Rust)
- 如何将多种语言设置放在单个 .clang 格式文件中
- C ++异步键盘输入(标准方式)
- 不同语言中的模运算符差异
- 其他语言的Qt键盘输入
- 获取当前活动语言键盘
- C++/Win32查找所有键盘输入语言
- 如何在Windows(c++)中更改语言键盘布局
- 如何在用户更改Windows中的语言键盘布局时得到通知
- 如何在c++控制台应用程序中确定当前的键盘语言