Restore/minimize the Language Bar to get it out of the way of a full-screen application?

by Michael S. Kaplan, published on 2010/05/12 07:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2010/05/12/10010566.aspx


Over in the Suggestion Box, Ben asked:

Like many, I am really enjoying Windows 7.

However, there is one little issue that I notice almost daily.

As I am constantly switching between English, Japanese, Korean, and Chinese, I usually always "Restore the [IME] language bar" on the desktop. Hence, it is not minimized to the tray. This is my preferred setting.

Whenever I watch a movie in Media Player, I set the screen to full size. This works well; however, the IME bar never disappears instead overlays the video. As there is not much opportunity to type anything while watching a movie in full screen, I think it would be best if the IME would become invisible.

I do not remember anymore, but I do not recall having this type of problem in XP. Other than manually minimizing it, is there anything that can be done to solve this tiny but constant issue? Not sure if this would be an IME or a Media Player issue.

One has to love the "one little issue" questions, you know? :-)

First we'll take a step back.

And say that yes, this is a Media Player issue.

Because Media Player can implement UILess Mode for when it is completely maximized if it wants to.

But it isn't doing that, so we have to move on now and see what we can do in spite of that fact.

So we will keep looking, now.

Of course the easiest thing one can do is the minimize/restore dance....

but Ben is already saying that is the thing he's like to avoid.

Now there ianother option, on that same menu.

That Transparency item:

If you select it, then the language bar will be a lot less substantial when you aren't interacting with it.

Like this:

This may or may not be distracting, kind of depends.

That "Vertical" option can also be worth considering, though most people don't like to go that route.

Now if you use your IMEs so often that you do all of the interaction via the various keyboard shortcuts, then you have yet another option.

Hot keys!

Just assign a different hot key to each IME you want to

and then hide the Language Bar completely!

But a lot of people (and I am assuming Ben is one of them) want the Language Bar to be there when they might be using the IME.

And this limits the options a lot more.

Now at an obvious level there is a user interface that lets one pick the "status" of the Language Bar's interface:

This suggests there must be a way for anyone to make that change.

Now spulenking around in the exports of various relevant DLLs finds the following:

Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file c:\Windows\System32\msctf.dll

File Type: DLL

  Section contains the following exports for MSCTF.dll

    00000000 characteristics
    4A5BC5DC time date stamp Mon Jul 13 16:40:12 2009
        0.00 version
           1 ordinal base
          71 number of functions
          71 number of names

    ordinal hint RVA      name

          2    0 0000382C CtfImeAssociateFocus
...{skip some exports}
         55   35 0001A05C TF_GetShowFloatingStatus
...{skip some exports}
         68   43 00072ED0 TF_SetShowFloatingStatus
...{skip some exports}
         71   46 00041470 TF_WaitForInitialized

  Summary

        3000 .data
        A000 .pdata
       18000 .rdata
        2000 .reloc
       41000 .rsrc
       A0000 .text

But it hardly seems worth it to try to reverse engineer those functions, which are in all likelihood little more than thin wrappers around the ITfLangBarMgr::ShowFloating and ITfLangBarMgr::GetShowFloatingStatus methods on the ITfLangBarMgr interface.

If the code were any more complicated than something along the lines of:

    HRESULT hr;
    ITfLangBarMgr *pLangBarMgr = NULL;

    hr = CoCreateInstance(CLSID_TF_LangBarMgr, NULL, CLSCTX_INPROC_SERVER, IID_ITfLangBarMgr, (LPVOID*)&pLangBarMgr);
    if (SUCCEEDED(hr) && pLangBarMgr)
    {
        pLangBarMgr->ShowFloating(TF_SFT_MINIMIZED);
        pLangBarMgr->Release();
    }

(mostly snagged from the interface help topic!) then I would frankly be shocked.

Is it worth creating some little EXE that when run will detect what the state is and toggle it between TF_SFT_MINIMIZED and TF_SFT_SHOWNORMAL?

Well, I would leave that up to Ben or whoever is interested here.

Given an application that doesn't do the work to move the IME out of the way, that would really be the most one can do here....


richard on 12 May 2010 10:31 AM:

Related question; I use the standard leftAlt-shift kb shortcut to switch the IME between US English and JP modes. And i leave the IME bar as a docked toolbar(?).

However, when i switch to JP it seems to pretty much always end up in half-width alpha input mode, and there's not a shortcut i can find to switch to hiragana.

fwiw - ctrl-shift seems to shift ok between US englisn and intl english keyboards... surely there's an equivalent for input methods? or maybe a default setting i can't find s.t. the input method defaults to hiragana?

thanks.

ray on 12 May 2010 12:16 PM:

The previous commenter should press Alt+`. *My* question is why US English periodically adds itself back to the Language Bar even though I keep removing it.

Niels on 12 May 2010 12:18 PM:

richard:

The Japanese IME lets you toggle between half-width alpha and whatever other input mode was last used by left-Alt + the-key-above-tab-left of-1, i.e. backtick on standard US layout. Various combinations of Ctrl, Alt, Shift and CapsLock also switch between input modes.

A not-very-related issue I've noticed (on Vista 64) is that whenever an Adobe Flash applet has run in fullscreen, hosted in Firefox, it has always switched my Japanese IME into full-width hiragana input mode, even if a different input language was active at the time! It's probably some bug in Flash, I just haven't been able to find mention of it anywhere else.

Ben on 12 May 2010 3:40 PM:

Thanks for the post.

I should have mentioned that always have my IME set to Transparency.

I also use the hot keys as well. However, because I am always switching languages, it is nice to glance at the bar to see what the current language is and what mode it is (such as kana, rĊmaji, hangul, etc.)

After sending my initial post, I noticed that Media Player 12 does seem to implement UILess mode, although in a non-intuitive manner and probably not fully tested. When a movie is in full screen, if you click on the screen and wait, the IME will disappear. However, if you move the mouse again, it will reappear and you need to click again to make it disappear. Perhaps this is a focus problem. I checked in earlier versions and this is not an issue.

Michael S. Kaplan on 12 May 2010 8:38 PM:

Well, one could write an app that would automatically toggle the LangBar state and put a global hotkey on it....

richard on 13 May 2010 9:09 AM:

ray and neils, you rock.

thanks.  

jmdesp on 13 May 2010 3:59 PM:

The IME bar !!! Can someone explain to me why on my computer with French (default), English and Japanese, I constantly, after switching from an app to another, find myself with either the English or Japanese keyboard selected  ?

I thought for a long time that Alt-Shift is very near Alt-Tab, so I probably was very often hitting Alt-Shift without realizing it. But after I finally decided to disable Alt-Shift, and only allow direct selection of the keyboard, well it still happens just as often.

shiranaize on 16 May 2010 6:00 PM:

jmdesp > From my experience, the language bar will maintain whatever language you were last using with that program.  So if you go to Microsoft Office and typed something up in Japanese, then switch to your internet browser, which you last typed French in, the language bar will be in French.  It didn't change, it's just left over from the last time you used it.

The problem I'm having with the language toolbar is that sometimes, while I have it docked in the taskbar, it will randomly disappear when I go to type something on facebook or on an email.  I have to leave my internet browser and once more unminimize the toolbar to get it to cooperate.  I have Windows 7 and, more often than not, use Google Chrome.  Is this a problem with google chrome or what?  The language bar will remain displayed while docked most of the time, but then it just disappears when I go to type and will not change languages.  Any suggestions?

JFullert on 26 Jan 2012 2:29 PM:

I'm using code similar to the example you provided for the article to display the language bar and select an IME when the user clicks in an RichEdit Box after selecting the language they want to use.  I also move the language bar so that it looks like a tool bar of the dialog the control is in.  Everything works fine on my development PC (Windows Server 2003), but when I install it on the users PCs (Windows XP). The language bar isn't visible or won't move to the correct position.  My application runs full screen and Explorer isn't running.  Have any thoughts on how I might resolve that?


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