Win32 API 日本語リファレンス
ホームDevices.HumanInterfaceDevice › KEYBOARD_EXTENDED_ATTRIBUTES

KEYBOARD_EXTENDED_ATTRIBUTES

構造体
サイズx64: 7 バイト / x86: 7 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
VersionBYTE1+0+0拡張属性構造体のバージョン番号。
FormFactorBYTE1+1+1キーボードの形状(フォームファクター)を示す値。
KeyTypeBYTE1+2+2キーの種別を示す値。
PhysicalLayoutBYTE1+3+3物理的なキー配列を示す値。
VendorSpecificPhysicalLayoutBYTE1+4+4ベンダー固有の物理配列を示す値。
IETFLanguageTagIndexBYTE1+5+5IETF言語タグのインデックス値。
ImplementedInputAssistControlsBYTE1+6+6実装された入力支援コントロールを示すフラグ群。

各言語での定義

#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 Structure
import 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: uint8
struct 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