Win32 API 日本語リファレンス
ホームUI.Input.KeyboardAndMouse › VK_TO_WCHAR_TABLE

VK_TO_WCHAR_TABLE

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

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

フィールド

フィールドサイズx64x86説明
pVkToWcharsVK_TO_WCHARS1*8/4+0+0VK_TO_WCHARSn構造体の配列へのポインタ。仮想キーから文字への変換表本体を指す。
nModificationsBYTE1+8+4各エントリが保持する修飾状態(シフト列)の数。wch配列の有効長を示す。
cbSizeBYTE1+9+5VK_TO_WCHARSnエントリ1個分のバイトサイズ。配列走査時の要素間隔に用いる。

各言語での定義

#include <windows.h>

// VK_TO_WCHAR_TABLE  (x64 16 / x86 8 バイト)
typedef struct VK_TO_WCHAR_TABLE {
    VK_TO_WCHARS1* pVkToWchars;
    BYTE nModifications;
    BYTE cbSize;
} VK_TO_WCHAR_TABLE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VK_TO_WCHAR_TABLE
{
    public IntPtr pVkToWchars;
    public byte nModifications;
    public byte cbSize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VK_TO_WCHAR_TABLE
    Public pVkToWchars As IntPtr
    Public nModifications As Byte
    Public cbSize As Byte
End Structure
import ctypes
from ctypes import wintypes

class VK_TO_WCHAR_TABLE(ctypes.Structure):
    _fields_ = [
        ("pVkToWchars", ctypes.c_void_p),
        ("nModifications", ctypes.c_ubyte),
        ("cbSize", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct VK_TO_WCHAR_TABLE {
    pub pVkToWchars: *mut core::ffi::c_void,
    pub nModifications: u8,
    pub cbSize: u8,
}
import "golang.org/x/sys/windows"

type VK_TO_WCHAR_TABLE struct {
	pVkToWchars uintptr
	nModifications byte
	cbSize byte
}
type
  VK_TO_WCHAR_TABLE = record
    pVkToWchars: Pointer;
    nModifications: Byte;
    cbSize: Byte;
  end;
const VK_TO_WCHAR_TABLE = extern struct {
    pVkToWchars: ?*anyopaque,
    nModifications: u8,
    cbSize: u8,
};
type
  VK_TO_WCHAR_TABLE {.bycopy.} = object
    pVkToWchars: pointer
    nModifications: uint8
    cbSize: uint8
struct VK_TO_WCHAR_TABLE
{
    void* pVkToWchars;
    ubyte nModifications;
    ubyte cbSize;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VK_TO_WCHAR_TABLE サイズ: 8 バイト(x86)
dim st, 2    ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; pVkToWchars : VK_TO_WCHARS1* (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; nModifications : BYTE (+4, 1byte)  poke st,4,値  /  値 = peek(st,4)
; cbSize : BYTE (+5, 1byte)  poke st,5,値  /  値 = peek(st,5)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VK_TO_WCHAR_TABLE サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; pVkToWchars : VK_TO_WCHARS1* (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; nModifications : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; cbSize : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VK_TO_WCHAR_TABLE
    #field intptr pVkToWchars
    #field byte nModifications
    #field byte cbSize
#endstruct

stdim st, VK_TO_WCHAR_TABLE        ; NSTRUCT 変数を確保
st->nModifications = 100
mes "nModifications=" + st->nModifications