KEYBOARD_EXTENDED_ATTRIBUTES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Version | BYTE | 1 | +0 | +0 | この構造体のバージョンです。 KEYBOARD_EXTENDED_ATTRIBUTES_STRUCT_VERSION_1 のみがサポートされます。 | ||||||||||||||||||
| FormFactor | BYTE | 1 | +1 | +1 | キーボードのフォームファクターです (Usage ID: 0x2C1)。
| ||||||||||||||||||
| KeyType | BYTE | 1 | +2 | +2 | キーボードのキータイプです (Usage ID: 0x2C2)。
| ||||||||||||||||||
| PhysicalLayout | BYTE | 1 | +3 | +3 | キーボードの物理レイアウトです (Usage ID: 0x2C3)。
この値は、キーに印字された刻印のセットを指すものではなく、文字キー同士の相対的な位置と形状によって定義される物理的なキーセットのレイアウトのみを指します。この値は、キーボードが準拠する事実上の標準的な物理レイアウトのいずれであるかを示します。これらのレイアウトは一般に広く知られているものです。 | ||||||||||||||||||
| VendorSpecificPhysicalLayout | BYTE | 1 | +4 | +4 | 特定のベンダー固有キーボード物理レイアウトを表す数値識別子です (Usage ID: 0x2C4)。 このフィールドの値はハードウェアベンダーによって定義されますが、0x00 はベンダー固有キーボード物理レイアウトを指定しないことを表すものとして定義されています。0 以外の場合、PhysicalLayout は値 0x06 でなければなりません。この識別子が 0x00 の場合、PhysicalLayout は値 0x06 であってはなりません。 | ||||||||||||||||||
| IETFLanguageTagIndex | BYTE | 1 | +5 | +5 | IETF 言語タグを持つ文字列記述子 (String Descriptor) の文字列インデックスです (Usage ID: 0x2C5)。 実際の文字列は、カーネルモードドライバーでは IOCTL_HID_GET_INDEXED_STRING IOCTL によって、ユーザーモードアプリケーションでは HidD_GetIndexedString の呼び出しによって取得できます。 この言語タグは、IETF BCP 47 またはその後継仕様に準拠して、キーボードの刻印セットが想定する主要なロケールを指定します。 カスタムレイアウト、アダプティブレイアウト、新しいレイアウトなどで適切な IETF 言語タグが利用できない場合、この値は 0x00 に設定されます。 | ||||||||||||||||||
| ImplementedInputAssistControls | BYTE | 1 | +6 | +6 | 物理的に実装された入力アシストコントロールのビットマップです (Usage ID: 0x2C6)。
|
公式ドキュメント
KEYBOARD_EXTENDED_ATTRIBUTES は、キーボードの拡張属性を指定します。
解説(Remarks)
この構造体は、IOCTL_KEYBOARD_QUERY_EXTENDED_ATTRIBUTES 要求とともに使用され、キーボードがサポートする拡張属性に関する情報を返します。
この情報は、HID Usage Table Review Request 42: Consumer Page Keyboard Assist Controls に記述されている HID キーボードレポート記述子から取得されます。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// KEYBOARD_EXTENDED_ATTRIBUTES (x64 7 / x86 7 バイト)
typedef struct KEYBOARD_EXTENDED_ATTRIBUTES {
BYTE Version;
BYTE FormFactor;
BYTE KeyType;
BYTE PhysicalLayout;
BYTE VendorSpecificPhysicalLayout;
BYTE IETFLanguageTagIndex;
BYTE ImplementedInputAssistControls;
} KEYBOARD_EXTENDED_ATTRIBUTES;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KEYBOARD_EXTENDED_ATTRIBUTES
{
public byte Version;
public byte FormFactor;
public byte KeyType;
public byte PhysicalLayout;
public byte VendorSpecificPhysicalLayout;
public byte IETFLanguageTagIndex;
public byte ImplementedInputAssistControls;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KEYBOARD_EXTENDED_ATTRIBUTES
Public Version As Byte
Public FormFactor As Byte
Public KeyType As Byte
Public PhysicalLayout As Byte
Public VendorSpecificPhysicalLayout As Byte
Public IETFLanguageTagIndex As Byte
Public ImplementedInputAssistControls As Byte
End Structureimport ctypes
from ctypes import wintypes
class KEYBOARD_EXTENDED_ATTRIBUTES(ctypes.Structure):
_fields_ = [
("Version", ctypes.c_ubyte),
("FormFactor", ctypes.c_ubyte),
("KeyType", ctypes.c_ubyte),
("PhysicalLayout", ctypes.c_ubyte),
("VendorSpecificPhysicalLayout", ctypes.c_ubyte),
("IETFLanguageTagIndex", ctypes.c_ubyte),
("ImplementedInputAssistControls", ctypes.c_ubyte),
]#[repr(C)]
pub struct KEYBOARD_EXTENDED_ATTRIBUTES {
pub Version: u8,
pub FormFactor: u8,
pub KeyType: u8,
pub PhysicalLayout: u8,
pub VendorSpecificPhysicalLayout: u8,
pub IETFLanguageTagIndex: u8,
pub ImplementedInputAssistControls: u8,
}import "golang.org/x/sys/windows"
type KEYBOARD_EXTENDED_ATTRIBUTES struct {
Version byte
FormFactor byte
KeyType byte
PhysicalLayout byte
VendorSpecificPhysicalLayout byte
IETFLanguageTagIndex byte
ImplementedInputAssistControls byte
}type
KEYBOARD_EXTENDED_ATTRIBUTES = record
Version: Byte;
FormFactor: Byte;
KeyType: Byte;
PhysicalLayout: Byte;
VendorSpecificPhysicalLayout: Byte;
IETFLanguageTagIndex: Byte;
ImplementedInputAssistControls: Byte;
end;const KEYBOARD_EXTENDED_ATTRIBUTES = extern struct {
Version: u8,
FormFactor: u8,
KeyType: u8,
PhysicalLayout: u8,
VendorSpecificPhysicalLayout: u8,
IETFLanguageTagIndex: u8,
ImplementedInputAssistControls: u8,
};type
KEYBOARD_EXTENDED_ATTRIBUTES {.bycopy.} = object
Version: uint8
FormFactor: uint8
KeyType: uint8
PhysicalLayout: uint8
VendorSpecificPhysicalLayout: uint8
IETFLanguageTagIndex: uint8
ImplementedInputAssistControls: uint8struct KEYBOARD_EXTENDED_ATTRIBUTES
{
ubyte Version;
ubyte FormFactor;
ubyte KeyType;
ubyte PhysicalLayout;
ubyte VendorSpecificPhysicalLayout;
ubyte IETFLanguageTagIndex;
ubyte ImplementedInputAssistControls;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KEYBOARD_EXTENDED_ATTRIBUTES サイズ: 7 バイト(x64)
dim st, 2 ; 4byte整数×2(構造体サイズ 7 / 4 切り上げ)
; Version : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; FormFactor : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; KeyType : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; PhysicalLayout : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; VendorSpecificPhysicalLayout : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; IETFLanguageTagIndex : BYTE (+5, 1byte) poke st,5,値 / 値 = peek(st,5)
; ImplementedInputAssistControls : BYTE (+6, 1byte) poke st,6,値 / 値 = peek(st,6)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KEYBOARD_EXTENDED_ATTRIBUTES
#field byte Version
#field byte FormFactor
#field byte KeyType
#field byte PhysicalLayout
#field byte VendorSpecificPhysicalLayout
#field byte IETFLanguageTagIndex
#field byte ImplementedInputAssistControls
#endstruct
stdim st, KEYBOARD_EXTENDED_ATTRIBUTES ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version