Win32 API 日本語リファレンス
ホームSystem.Console › ExtKeySubst

ExtKeySubst

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

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

フィールド

フィールドサイズx64x86説明
wModWORD2+0+0置換を適用する修飾キーの状態。
wVirKeyWORD2+2+2対象となる仮想キーコード。
wUnicodeCharWCHAR2+4+4置換後に出力するUnicode文字。

各言語での定義

#include <windows.h>

// ExtKeySubst  (x64 6 / x86 6 バイト)
typedef struct ExtKeySubst {
    WORD wMod;
    WORD wVirKey;
    WCHAR wUnicodeChar;
} ExtKeySubst;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ExtKeySubst
{
    public ushort wMod;
    public ushort wVirKey;
    public char wUnicodeChar;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ExtKeySubst
    Public wMod As UShort
    Public wVirKey As UShort
    Public wUnicodeChar As Char
End Structure
import ctypes
from ctypes import wintypes

class ExtKeySubst(ctypes.Structure):
    _fields_ = [
        ("wMod", ctypes.c_ushort),
        ("wVirKey", ctypes.c_ushort),
        ("wUnicodeChar", ctypes.c_wchar),
    ]
#[repr(C)]
pub struct ExtKeySubst {
    pub wMod: u16,
    pub wVirKey: u16,
    pub wUnicodeChar: u16,
}
import "golang.org/x/sys/windows"

type ExtKeySubst struct {
	wMod uint16
	wVirKey uint16
	wUnicodeChar uint16
}
type
  ExtKeySubst = record
    wMod: Word;
    wVirKey: Word;
    wUnicodeChar: WideChar;
  end;
const ExtKeySubst = extern struct {
    wMod: u16,
    wVirKey: u16,
    wUnicodeChar: u16,
};
type
  ExtKeySubst {.bycopy.} = object
    wMod: uint16
    wVirKey: uint16
    wUnicodeChar: uint16
struct ExtKeySubst
{
    ushort wMod;
    ushort wVirKey;
    wchar wUnicodeChar;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ExtKeySubst サイズ: 6 バイト(x64)
dim st, 2    ; 4byte整数×2(構造体サイズ 6 / 4 切り上げ)
; wMod : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; wVirKey : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; wUnicodeChar : WCHAR (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ExtKeySubst
    #field short wMod
    #field short wVirKey
    #field short wUnicodeChar
#endstruct

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