ホーム › UI.Input.KeyboardAndMouse › KBDNLSTABLES
KBDNLSTABLES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| OEMIdentifier | WORD | 2 | +0 | +0 | キーボードのOEM識別子。ハードウェアベンダ固有のレイアウト識別に用いる。 |
| LayoutInformation | WORD | 2 | +2 | +2 | レイアウト情報フラグ。各国語固有のレイアウト特性を示す。 |
| NumOfVkToF | DWORD | 4 | +4 | +4 | pVkToF配列の要素数。FE向け特殊キー処理エントリの個数。 |
| pVkToF | VK_F* | 8/4 | +8 | +8 | VK_F構造体の配列へのポインタ。FE-IME向けキー処理表を指す。 |
| NumOfMouseVKey | INT | 4 | +16 | +12 | pusMouseVKey配列の要素数。マウス操作に割り当てる仮想キーの個数。 |
| pusMouseVKey | WORD* | 8/4 | +24 | +16 | マウス機能に対応付けた仮想キーコードの配列へのポインタ。 |
各言語での定義
#include <windows.h>
// KBDNLSTABLES (x64 32 / x86 20 バイト)
typedef struct KBDNLSTABLES {
WORD OEMIdentifier;
WORD LayoutInformation;
DWORD NumOfVkToF;
VK_F* pVkToF;
INT NumOfMouseVKey;
WORD* pusMouseVKey;
} KBDNLSTABLES;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KBDNLSTABLES
{
public ushort OEMIdentifier;
public ushort LayoutInformation;
public uint NumOfVkToF;
public IntPtr pVkToF;
public int NumOfMouseVKey;
public IntPtr pusMouseVKey;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KBDNLSTABLES
Public OEMIdentifier As UShort
Public LayoutInformation As UShort
Public NumOfVkToF As UInteger
Public pVkToF As IntPtr
Public NumOfMouseVKey As Integer
Public pusMouseVKey As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class KBDNLSTABLES(ctypes.Structure):
_fields_ = [
("OEMIdentifier", ctypes.c_ushort),
("LayoutInformation", ctypes.c_ushort),
("NumOfVkToF", wintypes.DWORD),
("pVkToF", ctypes.c_void_p),
("NumOfMouseVKey", ctypes.c_int),
("pusMouseVKey", ctypes.c_void_p),
]#[repr(C)]
pub struct KBDNLSTABLES {
pub OEMIdentifier: u16,
pub LayoutInformation: u16,
pub NumOfVkToF: u32,
pub pVkToF: *mut core::ffi::c_void,
pub NumOfMouseVKey: i32,
pub pusMouseVKey: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type KBDNLSTABLES struct {
OEMIdentifier uint16
LayoutInformation uint16
NumOfVkToF uint32
pVkToF uintptr
NumOfMouseVKey int32
pusMouseVKey uintptr
}type
KBDNLSTABLES = record
OEMIdentifier: Word;
LayoutInformation: Word;
NumOfVkToF: DWORD;
pVkToF: Pointer;
NumOfMouseVKey: Integer;
pusMouseVKey: Pointer;
end;const KBDNLSTABLES = extern struct {
OEMIdentifier: u16,
LayoutInformation: u16,
NumOfVkToF: u32,
pVkToF: ?*anyopaque,
NumOfMouseVKey: i32,
pusMouseVKey: ?*anyopaque,
};type
KBDNLSTABLES {.bycopy.} = object
OEMIdentifier: uint16
LayoutInformation: uint16
NumOfVkToF: uint32
pVkToF: pointer
NumOfMouseVKey: int32
pusMouseVKey: pointerstruct KBDNLSTABLES
{
ushort OEMIdentifier;
ushort LayoutInformation;
uint NumOfVkToF;
void* pVkToF;
int NumOfMouseVKey;
void* pusMouseVKey;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; KBDNLSTABLES サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; OEMIdentifier : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; LayoutInformation : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; NumOfVkToF : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pVkToF : VK_F* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; NumOfMouseVKey : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; pusMouseVKey : WORD* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KBDNLSTABLES サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; OEMIdentifier : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; LayoutInformation : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; NumOfVkToF : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pVkToF : VK_F* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; NumOfMouseVKey : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; pusMouseVKey : WORD* (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KBDNLSTABLES
#field short OEMIdentifier
#field short LayoutInformation
#field int NumOfVkToF
#field intptr pVkToF
#field int NumOfMouseVKey
#field intptr pusMouseVKey
#endstruct
stdim st, KBDNLSTABLES ; NSTRUCT 変数を確保
st->OEMIdentifier = 100
mes "OEMIdentifier=" + st->OEMIdentifier