Solved

WinXP/WinXP Embedded API to change IME

Posted on 2009-05-04
3
552 Views
Last Modified: 2013-12-14
Hi,

I am looking for an API on WinXP to switch between installed IME's. The scenario is, to be able to plug in a langauge keyboard (say Spanish) and change the IME by clicking on a 'language name button' on the UI (say button named Spanish)

Thanks
0
Comment
Question by:manavsharma
  • 2
3 Comments
 
LVL 2

Expert Comment

by:mannujam
ID: 24312740
You can use keybd_event for switching in between installed ime
Code:-
keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), 0, 0);
keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), 0, 0);
keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, MapVirtualKey(VK_MENU, 0), KEYEVENTF_KEYUP, 0);      

0
 

Accepted Solution

by:
manavsharma earned 0 total points
ID: 24312817
Thanks for the reply mannujam. I was trying to change the locale/ IME (which falls under the locale).
I found that there is an api named, 'SystemParametersInfo' which allows us to make settings on system level. In my case, I had to go to Control Panel > Regional Settings > and then switch between installed locales under Language tab. This could finally be achieved programatically as shown in the code:
// testing_SystemParametersInfo.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include "windows.h"
 
 
int _tmain(int argc, _TCHAR* argv[])
{
	HKL hLangId = 0;
	bool isFine;
	DWORD errorCode;
 
	errorCode = GetLastError();
 
	isFine = SystemParametersInfo(SPI_GETDEFAULTINPUTLANG, 0, &hLangId, 0);
 
	errorCode = GetLastError();
 
	HKL spanishLanguage = (HKL) (0x040a0c0a);
 
	isFine = SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, &spanishLanguage, 0);
 
	errorCode = GetLastError();
 
	return 0;
}

Open in new window

0
 
LVL 2

Expert Comment

by:mannujam
ID: 24313241
OK,  that'a fine
I thought  for switching between installed IME's  (langauge keyboard / LAnguage bar) shown nin staus bar,
SPI_(GET/SET)DEFAULTINPUTLANG  works fine for sublocale or locale


0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question