Solved

WinXP/WinXP Embedded API to change IME

Posted on 2009-05-04
3
547 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
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…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now