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

IMEKMSFUNCDESC

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

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

フィールド

フィールドサイズx64x86説明
cbSizeINT4+0+0本構造体のサイズをバイト単位で示す。
idLangWORD2+4+4対象とする言語IDである。
dwControlDWORD4+6+6説明対象の制御機能の識別値である。
pwszDescriptionWCHAR256+10+10制御機能の説明を示すUnicode文字列バッファである。

各言語での定義

#include <windows.h>

// IMEKMSFUNCDESC  (x64 266 / x86 266 バイト)
#pragma pack(push, 1)
typedef struct IMEKMSFUNCDESC {
    INT cbSize;
    WORD idLang;
    DWORD dwControl;
    WCHAR pwszDescription[128];
} IMEKMSFUNCDESC;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct IMEKMSFUNCDESC
{
    public int cbSize;
    public ushort idLang;
    public uint dwControl;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string pwszDescription;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure IMEKMSFUNCDESC
    Public cbSize As Integer
    Public idLang As UShort
    Public dwControl As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> Public pwszDescription As String
End Structure
import ctypes
from ctypes import wintypes

class IMEKMSFUNCDESC(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("cbSize", ctypes.c_int),
        ("idLang", ctypes.c_ushort),
        ("dwControl", wintypes.DWORD),
        ("pwszDescription", ctypes.c_wchar * 128),
    ]
#[repr(C, packed(1))]
pub struct IMEKMSFUNCDESC {
    pub cbSize: i32,
    pub idLang: u16,
    pub dwControl: u32,
    pub pwszDescription: [u16; 128],
}
import "golang.org/x/sys/windows"

type IMEKMSFUNCDESC struct {
	cbSize int32
	idLang uint16
	dwControl uint32
	pwszDescription [128]uint16
}
type
  IMEKMSFUNCDESC = packed record
    cbSize: Integer;
    idLang: Word;
    dwControl: DWORD;
    pwszDescription: array[0..127] of WideChar;
  end;
const IMEKMSFUNCDESC = extern struct {
    cbSize: i32,
    idLang: u16,
    dwControl: u32,
    pwszDescription: [128]u16,
};
type
  IMEKMSFUNCDESC {.packed.} = object
    cbSize: int32
    idLang: uint16
    dwControl: uint32
    pwszDescription: array[128, uint16]
align(1)
struct IMEKMSFUNCDESC
{
    int cbSize;
    ushort idLang;
    uint dwControl;
    wchar[128] pwszDescription;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IMEKMSFUNCDESC サイズ: 266 バイト(x64)
dim st, 67    ; 4byte整数×67(構造体サイズ 266 / 4 切り上げ)
; cbSize : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; idLang : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; dwControl : DWORD (+6, 4byte)  lpoke st,6,値  /  値 = lpeek(st,6)
; pwszDescription : WCHAR (+10, 256byte)  varptr(st)+10 を基点に操作(256byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global IMEKMSFUNCDESC, pack=1
    #field int cbSize
    #field short idLang
    #field int dwControl
    #field wchar pwszDescription 128
#endstruct

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