ホーム › UI.Input.KeyboardAndMouse › KBDTABLES
KBDTABLES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| pCharModifiers | MODIFIERS* | 8/4 | +0 | +0 | シフトやCtrl等の修飾キー状態を修飾番号へ変換するMODIFIERS表へのポインタ。 |
| pVkToWcharTable | VK_TO_WCHAR_TABLE* | 8/4 | +8 | +4 | 仮想キーから文字への変換表(VK_TO_WCHAR_TABLE)配列へのポインタ。 |
| pDeadKey | DEADKEY* | 8/4 | +16 | +8 | デッドキー合成情報を格納するDEADKEY配列へのポインタ。NULL可。 |
| pKeyNames | VSC_LPWSTR* | 8/4 | +24 | +12 | 標準キー名の文字列表(VSC_LPWSTR配列)へのポインタ。 |
| pKeyNamesExt | VSC_LPWSTR* | 8/4 | +32 | +16 | 拡張キー(E0プレフィックス)のキー名表へのポインタ。 |
| pKeyNamesDead | WORD** | 8/4 | +40 | +20 | デッドキー名の文字列配列へのポインタ。文字列ポインタ配列を指す。 |
| pusVSCtoVK | WORD* | 8/4 | +48 | +24 | スキャンコードから仮想キーへの変換配列へのポインタ。インデックスがスキャンコード。 |
| bMaxVSCtoVK | BYTE | 1 | +56 | +28 | pusVSCtoVK配列の最大エントリ数(スキャンコードの上限)。 |
| pVSCtoVK_E0 | VSC_VK* | 8/4 | +64 | +32 | E0プレフィックス付き拡張スキャンコードの変換表(VSC_VK配列)へのポインタ。 |
| pVSCtoVK_E1 | VSC_VK* | 8/4 | +72 | +36 | E1プレフィックス付きスキャンコードの変換表(VSC_VK配列)へのポインタ。 |
| fLocaleFlags | DWORD | 4 | +80 | +40 | ロケール固有の挙動を示すフラグ。MAKELONG(version,flags)形式で格納される。 |
| nLgMax | BYTE | 1 | +84 | +44 | 合字エントリ1個が保持する最大文字数。pLigature表の幅を示す。 |
| cbLgEntry | BYTE | 1 | +85 | +45 | 合字エントリ1個分のバイトサイズ。pLigature配列の走査間隔に用いる。 |
| pLigature | LIGATURE1* | 8/4 | +88 | +48 | 合字変換表(LIGATUREn配列)へのポインタ。NULL可。 |
| dwType | DWORD | 4 | +96 | +52 | キーボードレイアウトの種別を示す型番号。 |
| dwSubType | DWORD | 4 | +100 | +56 | キーボードレイアウトのサブ種別番号。型をさらに細分化する。 |
各言語での定義
#include <windows.h>
// KBDTABLES (x64 104 / x86 60 バイト)
typedef struct KBDTABLES {
MODIFIERS* pCharModifiers;
VK_TO_WCHAR_TABLE* pVkToWcharTable;
DEADKEY* pDeadKey;
VSC_LPWSTR* pKeyNames;
VSC_LPWSTR* pKeyNamesExt;
WORD** pKeyNamesDead;
WORD* pusVSCtoVK;
BYTE bMaxVSCtoVK;
VSC_VK* pVSCtoVK_E0;
VSC_VK* pVSCtoVK_E1;
DWORD fLocaleFlags;
BYTE nLgMax;
BYTE cbLgEntry;
LIGATURE1* pLigature;
DWORD dwType;
DWORD dwSubType;
} KBDTABLES;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KBDTABLES
{
public IntPtr pCharModifiers;
public IntPtr pVkToWcharTable;
public IntPtr pDeadKey;
public IntPtr pKeyNames;
public IntPtr pKeyNamesExt;
public IntPtr pKeyNamesDead;
public IntPtr pusVSCtoVK;
public byte bMaxVSCtoVK;
public IntPtr pVSCtoVK_E0;
public IntPtr pVSCtoVK_E1;
public uint fLocaleFlags;
public byte nLgMax;
public byte cbLgEntry;
public IntPtr pLigature;
public uint dwType;
public uint dwSubType;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KBDTABLES
Public pCharModifiers As IntPtr
Public pVkToWcharTable As IntPtr
Public pDeadKey As IntPtr
Public pKeyNames As IntPtr
Public pKeyNamesExt As IntPtr
Public pKeyNamesDead As IntPtr
Public pusVSCtoVK As IntPtr
Public bMaxVSCtoVK As Byte
Public pVSCtoVK_E0 As IntPtr
Public pVSCtoVK_E1 As IntPtr
Public fLocaleFlags As UInteger
Public nLgMax As Byte
Public cbLgEntry As Byte
Public pLigature As IntPtr
Public dwType As UInteger
Public dwSubType As UInteger
End Structureimport ctypes
from ctypes import wintypes
class KBDTABLES(ctypes.Structure):
_fields_ = [
("pCharModifiers", ctypes.c_void_p),
("pVkToWcharTable", ctypes.c_void_p),
("pDeadKey", ctypes.c_void_p),
("pKeyNames", ctypes.c_void_p),
("pKeyNamesExt", ctypes.c_void_p),
("pKeyNamesDead", ctypes.c_void_p),
("pusVSCtoVK", ctypes.c_void_p),
("bMaxVSCtoVK", ctypes.c_ubyte),
("pVSCtoVK_E0", ctypes.c_void_p),
("pVSCtoVK_E1", ctypes.c_void_p),
("fLocaleFlags", wintypes.DWORD),
("nLgMax", ctypes.c_ubyte),
("cbLgEntry", ctypes.c_ubyte),
("pLigature", ctypes.c_void_p),
("dwType", wintypes.DWORD),
("dwSubType", wintypes.DWORD),
]#[repr(C)]
pub struct KBDTABLES {
pub pCharModifiers: *mut core::ffi::c_void,
pub pVkToWcharTable: *mut core::ffi::c_void,
pub pDeadKey: *mut core::ffi::c_void,
pub pKeyNames: *mut core::ffi::c_void,
pub pKeyNamesExt: *mut core::ffi::c_void,
pub pKeyNamesDead: *mut core::ffi::c_void,
pub pusVSCtoVK: *mut core::ffi::c_void,
pub bMaxVSCtoVK: u8,
pub pVSCtoVK_E0: *mut core::ffi::c_void,
pub pVSCtoVK_E1: *mut core::ffi::c_void,
pub fLocaleFlags: u32,
pub nLgMax: u8,
pub cbLgEntry: u8,
pub pLigature: *mut core::ffi::c_void,
pub dwType: u32,
pub dwSubType: u32,
}import "golang.org/x/sys/windows"
type KBDTABLES struct {
pCharModifiers uintptr
pVkToWcharTable uintptr
pDeadKey uintptr
pKeyNames uintptr
pKeyNamesExt uintptr
pKeyNamesDead uintptr
pusVSCtoVK uintptr
bMaxVSCtoVK byte
pVSCtoVK_E0 uintptr
pVSCtoVK_E1 uintptr
fLocaleFlags uint32
nLgMax byte
cbLgEntry byte
pLigature uintptr
dwType uint32
dwSubType uint32
}type
KBDTABLES = record
pCharModifiers: Pointer;
pVkToWcharTable: Pointer;
pDeadKey: Pointer;
pKeyNames: Pointer;
pKeyNamesExt: Pointer;
pKeyNamesDead: Pointer;
pusVSCtoVK: Pointer;
bMaxVSCtoVK: Byte;
pVSCtoVK_E0: Pointer;
pVSCtoVK_E1: Pointer;
fLocaleFlags: DWORD;
nLgMax: Byte;
cbLgEntry: Byte;
pLigature: Pointer;
dwType: DWORD;
dwSubType: DWORD;
end;const KBDTABLES = extern struct {
pCharModifiers: ?*anyopaque,
pVkToWcharTable: ?*anyopaque,
pDeadKey: ?*anyopaque,
pKeyNames: ?*anyopaque,
pKeyNamesExt: ?*anyopaque,
pKeyNamesDead: ?*anyopaque,
pusVSCtoVK: ?*anyopaque,
bMaxVSCtoVK: u8,
pVSCtoVK_E0: ?*anyopaque,
pVSCtoVK_E1: ?*anyopaque,
fLocaleFlags: u32,
nLgMax: u8,
cbLgEntry: u8,
pLigature: ?*anyopaque,
dwType: u32,
dwSubType: u32,
};type
KBDTABLES {.bycopy.} = object
pCharModifiers: pointer
pVkToWcharTable: pointer
pDeadKey: pointer
pKeyNames: pointer
pKeyNamesExt: pointer
pKeyNamesDead: pointer
pusVSCtoVK: pointer
bMaxVSCtoVK: uint8
pVSCtoVK_E0: pointer
pVSCtoVK_E1: pointer
fLocaleFlags: uint32
nLgMax: uint8
cbLgEntry: uint8
pLigature: pointer
dwType: uint32
dwSubType: uint32struct KBDTABLES
{
void* pCharModifiers;
void* pVkToWcharTable;
void* pDeadKey;
void* pKeyNames;
void* pKeyNamesExt;
void* pKeyNamesDead;
void* pusVSCtoVK;
ubyte bMaxVSCtoVK;
void* pVSCtoVK_E0;
void* pVSCtoVK_E1;
uint fLocaleFlags;
ubyte nLgMax;
ubyte cbLgEntry;
void* pLigature;
uint dwType;
uint dwSubType;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; KBDTABLES サイズ: 60 バイト(x86)
dim st, 15 ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; pCharModifiers : MODIFIERS* (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; pVkToWcharTable : VK_TO_WCHAR_TABLE* (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; pDeadKey : DEADKEY* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; pKeyNames : VSC_LPWSTR* (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; pKeyNamesExt : VSC_LPWSTR* (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; pKeyNamesDead : WORD** (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pusVSCtoVK : WORD* (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; bMaxVSCtoVK : BYTE (+28, 1byte) poke st,28,値 / 値 = peek(st,28)
; pVSCtoVK_E0 : VSC_VK* (+32, 4byte) varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; pVSCtoVK_E1 : VSC_VK* (+36, 4byte) varptr(st)+36 を基点に操作(4byte:入れ子/配列)
; fLocaleFlags : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; nLgMax : BYTE (+44, 1byte) poke st,44,値 / 値 = peek(st,44)
; cbLgEntry : BYTE (+45, 1byte) poke st,45,値 / 値 = peek(st,45)
; pLigature : LIGATURE1* (+48, 4byte) varptr(st)+48 を基点に操作(4byte:入れ子/配列)
; dwType : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; dwSubType : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KBDTABLES サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; pCharModifiers : MODIFIERS* (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; pVkToWcharTable : VK_TO_WCHAR_TABLE* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; pDeadKey : DEADKEY* (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; pKeyNames : VSC_LPWSTR* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; pKeyNamesExt : VSC_LPWSTR* (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; pKeyNamesDead : WORD** (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; pusVSCtoVK : WORD* (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; bMaxVSCtoVK : BYTE (+56, 1byte) poke st,56,値 / 値 = peek(st,56)
; pVSCtoVK_E0 : VSC_VK* (+64, 8byte) varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; pVSCtoVK_E1 : VSC_VK* (+72, 8byte) varptr(st)+72 を基点に操作(8byte:入れ子/配列)
; fLocaleFlags : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; nLgMax : BYTE (+84, 1byte) poke st,84,値 / 値 = peek(st,84)
; cbLgEntry : BYTE (+85, 1byte) poke st,85,値 / 値 = peek(st,85)
; pLigature : LIGATURE1* (+88, 8byte) varptr(st)+88 を基点に操作(8byte:入れ子/配列)
; dwType : DWORD (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; dwSubType : DWORD (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KBDTABLES
#field intptr pCharModifiers
#field intptr pVkToWcharTable
#field intptr pDeadKey
#field intptr pKeyNames
#field intptr pKeyNamesExt
#field intptr pKeyNamesDead
#field intptr pusVSCtoVK
#field byte bMaxVSCtoVK
#field intptr pVSCtoVK_E0
#field intptr pVSCtoVK_E1
#field int fLocaleFlags
#field byte nLgMax
#field byte cbLgEntry
#field intptr pLigature
#field int dwType
#field int dwSubType
#endstruct
stdim st, KBDTABLES ; NSTRUCT 変数を確保
st->bMaxVSCtoVK = 100
mes "bMaxVSCtoVK=" + st->bMaxVSCtoVK