|

楼主 |
发表于 2019-11-7 16:33:52
|
显示全部楼层
哦,搞定了。
// closeinput.cpp : 定义控制台应用程序的入口点。
#include "stdafx.h"
//#include <afx.h>
//#include <iostream>
#include<windows.h>
#include<winuser.h>
//#include <imm.h>
//#pragma comment(lib, "imm32.lib")
#pragma comment(lib, "user32.lib")
int _tmain(int argc, _TCHAR* argv[])
{
// using namespace std;
// //HWND hWnd = GetActiveWindow();
//HWND hWnd= GetForegroundWindow();
////cout<<hWnd<<endl;
//
// HIMC hIMC = ImmAssociateContext(hWnd, NULL);
//现在是中文输入法,修改为英文输入法(为什么ImmSimulateHotKey函数不行???)
HWND hWnd= GetForegroundWindow();
HKL hkl = LoadKeyboardLayout(_T("00000409"),KLF_ACTIVATE);
PostMessage(hWnd, WM_INPUTLANGCHANGEREQUEST,(WPARAM)TRUE, (LPARAM)hkl);
return 0;
}
|
|