Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6878597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:44:37+00:00 2026-05-27T04:44:37+00:00

I am writing an onscreen keyboard and would like to redraw my layout as

  • 0

I am writing an onscreen keyboard and would like to redraw my layout as soon as keyboard layout is changed.

Currently I call:

GetKeyboardLayout(GetWindowThreadProcessId(GetForegroundWindow(), NULL));

on every key press to find out if the layout has changed. It does not work if user changes the layout by mouse, until key is pressed.

I would like to know if there is any way to get notified
when the keyboard layout of the current foreground window is changed,
so I can redraw my layout as soon as the change happens.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:44:38+00:00Added an answer on May 27, 2026 at 4:44 am

    There is a way …

    First you need to register your application to capture foreground window changes:
    Use SetWinEventHook with EVENT_SYSTEM_FOREGROUND (and WINEVENT_OUTOFCONTEXT as it’s .NET) for that.

    If that happens: Use your GetKeyboardLayout solution for getting the current layout of that window.

    Then use a local Windows Hook (you’re probably using it low-level-globally for key captures) with WH_CALLWNDPROC and the thread of the new foreground window.
    Listen to WM_INPUTLANGCHANGE messages to that window to receive changes to the layout.
    (You may want to unhook/rehook after another foreground change)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing in C# what could basically be called my own interpretation of
I am attempting to write a specialized onscreen keyboard (OSK) for an application I'm
Okay, so basically I want to be able to retrieve keyboard text. Like entering
Say we have (pseudo) code like this: GetInput() { //insert keyboard stuff here }
I'm writing a little arcade-like game in C++ (a multidirectional 2d space shooter) and
I'm writing an app based around a calculator-like UI. On an iPad, I'd like
I am writing my own on screen keyboard. The only piece missing is the
I'm currently writing an interactive simulator which displays the evolution of a system of
If I were writing a native app I would try the solution given here
Writing Classic ASP code in JScript has a lot going for it: more humane

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.