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

IMEKMSKMP

構造体
サイズx64: 30 バイト / x86: 22 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
cbSizeINT4+0+0本構造体のサイズをバイト単位で示す。
hIMCHIMC8/4+4+4対象の入力コンテキストハンドルHIMCである。
idLangWORD2+12+8対象とする言語IDである。
wVKStartWORD2+14+10対象仮想キー範囲の開始値である。
wVKEndWORD2+16+12対象仮想キー範囲の終了値である。
cKeyListINT4+18+14pKeyListのキー定義個数である。
pKeyListIMEKMSKEY*8/4+22+18キーマップ定義IMEKMSKEY配列へのポインタである。

各言語での定義

#include <windows.h>

// IMEKMSKMP  (x64 30 / x86 22 バイト)
#pragma pack(push, 1)
typedef struct IMEKMSKMP {
    INT cbSize;
    HIMC hIMC;
    WORD idLang;
    WORD wVKStart;
    WORD wVKEnd;
    INT cKeyList;
    IMEKMSKEY* pKeyList;
} IMEKMSKMP;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct IMEKMSKMP
{
    public int cbSize;
    public IntPtr hIMC;
    public ushort idLang;
    public ushort wVKStart;
    public ushort wVKEnd;
    public int cKeyList;
    public IntPtr pKeyList;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure IMEKMSKMP
    Public cbSize As Integer
    Public hIMC As IntPtr
    Public idLang As UShort
    Public wVKStart As UShort
    Public wVKEnd As UShort
    Public cKeyList As Integer
    Public pKeyList As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class IMEKMSKMP(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("cbSize", ctypes.c_int),
        ("hIMC", ctypes.c_void_p),
        ("idLang", ctypes.c_ushort),
        ("wVKStart", ctypes.c_ushort),
        ("wVKEnd", ctypes.c_ushort),
        ("cKeyList", ctypes.c_int),
        ("pKeyList", ctypes.c_void_p),
    ]
#[repr(C, packed(1))]
pub struct IMEKMSKMP {
    pub cbSize: i32,
    pub hIMC: *mut core::ffi::c_void,
    pub idLang: u16,
    pub wVKStart: u16,
    pub wVKEnd: u16,
    pub cKeyList: i32,
    pub pKeyList: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type IMEKMSKMP struct {
	cbSize int32
	hIMC uintptr
	idLang uint16
	wVKStart uint16
	wVKEnd uint16
	cKeyList int32
	pKeyList uintptr
}
type
  IMEKMSKMP = packed record
    cbSize: Integer;
    hIMC: Pointer;
    idLang: Word;
    wVKStart: Word;
    wVKEnd: Word;
    cKeyList: Integer;
    pKeyList: Pointer;
  end;
const IMEKMSKMP = extern struct {
    cbSize: i32,
    hIMC: ?*anyopaque,
    idLang: u16,
    wVKStart: u16,
    wVKEnd: u16,
    cKeyList: i32,
    pKeyList: ?*anyopaque,
};
type
  IMEKMSKMP {.packed.} = object
    cbSize: int32
    hIMC: pointer
    idLang: uint16
    wVKStart: uint16
    wVKEnd: uint16
    cKeyList: int32
    pKeyList: pointer
align(1)
struct IMEKMSKMP
{
    int cbSize;
    void* hIMC;
    ushort idLang;
    ushort wVKStart;
    ushort wVKEnd;
    int cKeyList;
    void* pKeyList;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; IMEKMSKMP サイズ: 22 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 22 / 4 切り上げ)
; cbSize : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hIMC : HIMC (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; idLang : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; wVKStart : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; wVKEnd : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; cKeyList : INT (+14, 4byte)  lpoke st,14,値  /  値 = lpeek(st,14)
; pKeyList : IMEKMSKEY* (+18, 4byte)  varptr(st)+18 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IMEKMSKMP サイズ: 30 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 30 / 4 切り上げ)
; cbSize : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hIMC : HIMC (+4, 8byte)  qpoke st,4,値 / qpeek(st,4)  ※IronHSPのみ。3.7/3.8は lpoke st,4,下位 : lpoke st,8,上位
; idLang : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; wVKStart : WORD (+14, 2byte)  wpoke st,14,値  /  値 = wpeek(st,14)
; wVKEnd : WORD (+16, 2byte)  wpoke st,16,値  /  値 = wpeek(st,16)
; cKeyList : INT (+18, 4byte)  lpoke st,18,値  /  値 = lpeek(st,18)
; pKeyList : IMEKMSKEY* (+22, 8byte)  varptr(st)+22 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global IMEKMSKMP, pack=1
    #field int cbSize
    #field intptr hIMC
    #field short idLang
    #field short wVKStart
    #field short wVKEnd
    #field int cKeyList
    #field intptr pKeyList
#endstruct

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