Solved

WinXP/WinXP Embedded API to change IME

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Global Keyboard Hooks Blocked 4 70
Recommendation vb6 to vb.net or others 14 112
Why isn't object file created? 6 42
oracle 11g 23 50
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

895 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

19 Experts available now in Live!

Get 1:1 Help Now