?
Solved

How to switch Keyboard indicator ?

Posted on 2003-03-08
4
Medium Priority
?
236 Views
Last Modified: 2010-04-04
I would like to switch windows keyboard indicator in traybar.
How to send a message ?

thanks for advance
0
Comment
Question by:tong111797
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Expert Comment

by:JamesLondon
ID: 8095826

The following example toggles the Num-Lock Keyboard Light on and off. Just Change VK_NUMLOCK to the one you want...


if Odd(GetAsyncKeyState( VK_NUMLOCK )) <> True Then
  begin
    keybd_event(VK_NUMLOCK, MapVirtualkey(VK_NUMLOCK, 0), KEYEVENTF_EXTENDEDKEY, 0);
    keybd_event(VK_NUMLOCK, MapVirtualkey(VK_NUMLOCK, 0), KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);
  End;

Best Regards,
James
0
 
LVL 1

Expert Comment

by:khalil_moghaddam
ID: 8098596
Hi tong!

use LoadKeyboardLayout API, See Delphi help for example
0
 

Author Comment

by:tong111797
ID: 8126314
I found the solution.

var
  hklEN      : HKL;
  hklTH      : HKL;

procedure TForm1.FormCreate(Sender: TObject);
begin
  hklEN := LoadKeyboardLayout('00000409',0);
  hklTH := LoadKeyboardLayout('0000041E',0);
end;


in my procedure switch it by

     Handle := GetFocus;
     SendMessage(Handle,WM_INPUTLANGCHANGEREQUEST,0,hklTH);
or
     SendMessage(Handle,WM_INPUTLANGCHANGEREQUEST,0,hklEN);


0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 8127198
Points refunded and placed in PAQ

Computer101
E-E Admin
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question