ホーム › System.Console › ExtKeyDef
ExtKeyDef
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| keys | ExtKeySubst | 18 | +0 | +0 | 拡張キー定義を構成するExtKeySubst(キー置換定義)。 |
各言語での定義
#include <windows.h>
// ExtKeySubst (x64 6 / x86 6 バイト)
typedef struct ExtKeySubst {
WORD wMod;
WORD wVirKey;
WCHAR wUnicodeChar;
} ExtKeySubst;
// ExtKeyDef (x64 18 / x86 18 バイト)
typedef struct ExtKeyDef {
ExtKeySubst keys[3];
} ExtKeyDef;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ExtKeySubst
{
public ushort wMod;
public ushort wVirKey;
public char wUnicodeChar;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ExtKeyDef
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public ExtKeySubst[] keys;
}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
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ExtKeyDef
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public keys() As ExtKeySubst
End Structureimport ctypes
from ctypes import wintypes
class ExtKeySubst(ctypes.Structure):
_fields_ = [
("wMod", ctypes.c_ushort),
("wVirKey", ctypes.c_ushort),
("wUnicodeChar", ctypes.c_wchar),
]
class ExtKeyDef(ctypes.Structure):
_fields_ = [
("keys", ExtKeySubst * 3),
]#[repr(C)]
pub struct ExtKeySubst {
pub wMod: u16,
pub wVirKey: u16,
pub wUnicodeChar: u16,
}
#[repr(C)]
pub struct ExtKeyDef {
pub keys: [ExtKeySubst; 3],
}import "golang.org/x/sys/windows"
type ExtKeySubst struct {
wMod uint16
wVirKey uint16
wUnicodeChar uint16
}
type ExtKeyDef struct {
keys [3]ExtKeySubst
}type
ExtKeySubst = record
wMod: Word;
wVirKey: Word;
wUnicodeChar: WideChar;
end;
ExtKeyDef = record
keys: array[0..2] of ExtKeySubst;
end;const ExtKeySubst = extern struct {
wMod: u16,
wVirKey: u16,
wUnicodeChar: u16,
};
const ExtKeyDef = extern struct {
keys: [3]ExtKeySubst,
};type
ExtKeySubst {.bycopy.} = object
wMod: uint16
wVirKey: uint16
wUnicodeChar: uint16
ExtKeyDef {.bycopy.} = object
keys: array[3, ExtKeySubst]struct ExtKeySubst
{
ushort wMod;
ushort wVirKey;
wchar wUnicodeChar;
}
struct ExtKeyDef
{
ExtKeySubst[3] keys;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ExtKeyDef サイズ: 18 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 18 / 4 切り上げ)
; keys : ExtKeySubst (+0, 18byte) varptr(st)+0 を基点に操作(18byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global ExtKeySubst
#field short wMod
#field short wVirKey
#field short wUnicodeChar
#endstruct
#defstruct global ExtKeyDef
#field ExtKeySubst keys 3
#endstruct
stdim st, ExtKeyDef ; NSTRUCT 変数を確保