'If it is easy, then there are samples. And if it's very easy, everyone is writing them.'

by Michael S. Kaplan, published on 2012/08/28 07:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2012/08/28/10344043.aspx


So, it started yesterday.

With Jon Fullerton's question in Cutting the cord, revisited -- and documenting how to get the job done!.

I answered it (as best as I could) in When functions don't do what you want them to....

I should have looked harder, though.

Because he also put something in the Suggestion Box!

Specifically, he asked:

Michael,

It has been quite a while since the discussions on IME's, activating keyboard layouts, etc. I need to select a specific IME for a text box based upon a language selected by the user. I also need to position the Language bar so they can easily find it if they need to make changes. How about a topic on that addressing versions of Windows like Win 7 and Server 2008?

Thanks

Hmmm.

Well, to start, there is the big KLID/GUID list in From KLID to GUID (aka KLIDoral stimulation, it feels GUID).

There are listed the IMEs and the languages they go with.

You can use InstallLayoutOrTip with any of those functions to install any one of them.

Assuming they are installed, you can start looking at EnumEnabledLayoutOrTip to see what is there.

Unfortunately, you may be limited to using some calculations and a call to GetKeyboardLayoutList and ActivateKeyboardLayout to do the activation.

Messy.

A problem different from the ones I describe in What a tangled web we weave when a KLID from an HKL we must receive and What do you get when you put a Hebrew on top of a Russian? (aka What lies beneath can bite you on the ass), but with the same cause nevertheless.

This really needs to be easier.

I guess one could dig into Cicero here somehow. But good luck trying to figure out how do that. ;-(

The simple rule that every developer needs to internalize:

"If it is easy, then there are samples. And if it's very easy, everyone is writing them."

Now Jon's last question, about how to position the Language Bar, is that you can't. It's for users to do themselves, not for developers to do (even at the behest of the user)...


no comments

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

go to newer or older post, or back to index or month or day