.NET/Windows API for .NET

ActivateKeyboardLayout - Keyboard 언어별 선택함수

클리엘 2019. 8. 12. 11:26
728x90

Windows OS에 다음과 같이 Keyboard가 언어별로 설정되어 있을때


ActivateKeyboardLayout 함수는 Keyboard설정중 하나를 선택할 수 있도록 합니다.

Declare Function ActivateKeyboardLayout Lib "user32" Alias "ActivateKeyboardLayout" (ByVal HKL As Integer, ByVal flag As Integer) As Integer

▶VB.NET 선언

Private Const HKL_NEXT As Integer = 0
Private Const HKL_PREV As Integer = 1

ActivateKeyboardLayout(HKL_NEXT, 8)

▶VB.NET 호출

[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int ActivateKeyboardLayout(int HKL, int flag);

▶C# 선언

private const int HKL_NEXT = 0;
private const int HKL_PREV = 0;

ActivateKeyboardLayout(HKL_NEXT, 8)

▶C# 호출


ActivateKeyboardLayout 함수에서 첫번째로 0과 1이 전달되는데 0은 다음차례에 속하는 Keyboard설정을 1은 현재 선택된 설정의 이전에 있는 설정을 선택하도록 합니다.

두번째 인수에서 8은 ActivateKeyboardLayout 함수로 선택된 Keyboard언어설정을 처음순서로 바뀌도록 합니다.

728x90