Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying current language layout in traybar
    primarykey
    data
    text
    <p>Basically I want to write an application which would display the current language as a tray icon. Mainly I can code C++ and C#. Guess Google would help me out but I would like to ask it here first, since the community, the knowledge here is something I trust. </p> <p>(Never wrangled with such parts of the system so far. So that's why I would like to ask the community.)</p> <p>Okay thanks to your help, I managed to discover two ways. Using the <code>DllImport</code> in C# (importing the <code>user32.dll</code>) and the <code>InputLanguage</code>. </p> <p>Found a snippet: </p> <pre><code>public void SetNewCurrentLanguage() { // Gets the default, and current languages. InputLanguage myDefaultLanguage = InputLanguage.DefaultInputLanguage; InputLanguage myCurrentLanguage = InputLanguage.CurrentInputLanguage; textBox1.Text = "Current input language is: " + myCurrentLanguage.Culture.EnglishName + '\n'; textBox1.Text += "Default input language is: " + myDefaultLanguage.Culture.EnglishName + '\n'; // Changes the current input language to the default, and prints the new current language. InputLanguage.CurrentInputLanguage = myDefaultLanguage; textBox1.Text += "Current input language is now: " + myDefaultLanguage.Culture.EnglishName; } </code></pre> <p>I applied this like the following: </p> <pre><code> InputLanguage myCurrentLanguage = InputLanguage.CurrentInputLanguage; notifyIcon.Text = myCurrentLanguage.LayoutName + '\n' + myCurrentLanguage.Culture.DisplayName; </code></pre> <p>This displays it if you hover it above the icon. However, it won't update on switch, nor show the layout as text in the tray area. For that, I found a "<a href="http://www.vbforfree.com/?p=302" rel="nofollow noreferrer">Drawing in VB.NET</a>" article, maybe this will help me working out this issue. About the switch detect, that's a good question.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload