dcsimg
Results 1 to 4 of 4

Thread: Check for Keyboard Language Change even if form lost focus ?

  1. #1

    Thread Starter
    Addicted Member GlowingVB's Avatar
    Join Date
    Feb 2014
    Posts
    234

    Question Check for Keyboard Language Change even if form lost focus ?

    Greetings,
    with the code below, It is possible to get current keyboard language :
    Code:
            Dim myCurrentLanguage As InputLanguage
    
            myCurrentLanguage = InputLanguage.CurrentInputLanguage
            textbox1.text = myCurrentLanguage.Culture.EnglishName
    If I want to detect any keyboard language change , I can use TextBox1.TextChanged event. But there is an issue.
    My program isn't visible to user (not hided, but Opacity = 0 )

    When user runs a program like firefox, Office word or ... , my program form gets deactivated , thus TextBox1.TextChanged event doesn't do anything anymore. If I get my form activated again , it works as expected.

    I do not want to have a timer to activate my form every second. It irritates users ...

    How to detect keyboard language change even if the form is deactivated


    Thanks in advance

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,729

    Re: Check for Keyboard Language Change even if form lost focus ?

    Quote Originally Posted by GlowingVB View Post
    I do not want to have a timer to activate my form every second.
    Why would you need to activate your form? Why couldn't you use the Timer to just get the current language without activating the form? You could start the Timer when the form loses focus and stop it when it regains focus. That's assuming that there isn't some other better way.

  3. #3

    Thread Starter
    Addicted Member GlowingVB's Avatar
    Join Date
    Feb 2014
    Posts
    234

    Re: Check for Keyboard Language Change even if form lost focus ?

    well, your way seems to solve the issue , but, only in one condition : no matter how long , form eventually gets activated again one day.
    This method doesn't update me with the latest keyboard language unless I select my form's window to be activated again. It might be 15 minutes later after the last keyboard language change. not a rational way ...


    My question is that : Isn't there really any way to get the latest keyboard language regardless to form's activation status ?!! How could it be possible if your answer is NO ?!

    In one of my programs , for some reasons , I need to notify my user if his machine keyboard language changes. But this program is supposed to be a background program , not something that must get activated after a while to work . I've been searching on the net for hours , nothing could solve this issue yet or maybe I didn't encounter a useful one yet , I didn't know it would be this much difficult, really
    Last edited by GlowingVB; May 21st, 2019 at 11:15 PM.

  4. #4

    Thread Starter
    Addicted Member GlowingVB's Avatar
    Join Date
    Feb 2014
    Posts
    234

    Re: Check for Keyboard Language Change even if form lost focus ?

    any registry key that holds value of current keyboard language ? if so , checking that is much easier

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width