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 UI button (say button named Spanish)

e.g. I plug in a Spanish keyboard and click on the UI button named Spanish. This should internally change the IME to Spanish, which is already installed