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

COMPOSITIONSTRING

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0本構造体と関連データを含む全体サイズである。
dwCompReadAttrLenDWORD4+4+4変換読み文字列の属性データ長である。
dwCompReadAttrOffsetDWORD4+8+8変換読み属性データへのオフセットである。
dwCompReadClauseLenDWORD4+12+12変換読み文節情報の長さである。
dwCompReadClauseOffsetDWORD4+16+16変換読み文節情報へのオフセットである。
dwCompReadStrLenDWORD4+20+20変換読み文字列の文字数である。
dwCompReadStrOffsetDWORD4+24+24変換読み文字列へのオフセットである。
dwCompAttrLenDWORD4+28+28変換文字列の属性データ長である。
dwCompAttrOffsetDWORD4+32+32変換文字列属性データへのオフセットである。
dwCompClauseLenDWORD4+36+36変換文字列文節情報の長さである。
dwCompClauseOffsetDWORD4+40+40変換文字列文節情報へのオフセットである。
dwCompStrLenDWORD4+44+44変換文字列の文字数である。
dwCompStrOffsetDWORD4+48+48変換文字列へのオフセットである。
dwCursorPosDWORD4+52+52変換文字列内のカーソル位置である。
dwDeltaStartDWORD4+56+56前回からの変更開始位置である。
dwResultReadClauseLenDWORD4+60+60確定読み文節情報の長さである。
dwResultReadClauseOffsetDWORD4+64+64確定読み文節情報へのオフセットである。
dwResultReadStrLenDWORD4+68+68確定読み文字列の文字数である。
dwResultReadStrOffsetDWORD4+72+72確定読み文字列へのオフセットである。
dwResultClauseLenDWORD4+76+76確定文字列文節情報の長さである。
dwResultClauseOffsetDWORD4+80+80確定文字列文節情報へのオフセットである。
dwResultStrLenDWORD4+84+84確定文字列の文字数である。
dwResultStrOffsetDWORD4+88+88確定文字列へのオフセットである。
dwPrivateSizeDWORD4+92+92IME独自データのサイズである。
dwPrivateOffsetDWORD4+96+96IME独自データへのオフセットである。

各言語での定義

#include <windows.h>

// COMPOSITIONSTRING  (x64 100 / x86 100 バイト)
typedef struct COMPOSITIONSTRING {
    DWORD dwSize;
    DWORD dwCompReadAttrLen;
    DWORD dwCompReadAttrOffset;
    DWORD dwCompReadClauseLen;
    DWORD dwCompReadClauseOffset;
    DWORD dwCompReadStrLen;
    DWORD dwCompReadStrOffset;
    DWORD dwCompAttrLen;
    DWORD dwCompAttrOffset;
    DWORD dwCompClauseLen;
    DWORD dwCompClauseOffset;
    DWORD dwCompStrLen;
    DWORD dwCompStrOffset;
    DWORD dwCursorPos;
    DWORD dwDeltaStart;
    DWORD dwResultReadClauseLen;
    DWORD dwResultReadClauseOffset;
    DWORD dwResultReadStrLen;
    DWORD dwResultReadStrOffset;
    DWORD dwResultClauseLen;
    DWORD dwResultClauseOffset;
    DWORD dwResultStrLen;
    DWORD dwResultStrOffset;
    DWORD dwPrivateSize;
    DWORD dwPrivateOffset;
} COMPOSITIONSTRING;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COMPOSITIONSTRING
{
    public uint dwSize;
    public uint dwCompReadAttrLen;
    public uint dwCompReadAttrOffset;
    public uint dwCompReadClauseLen;
    public uint dwCompReadClauseOffset;
    public uint dwCompReadStrLen;
    public uint dwCompReadStrOffset;
    public uint dwCompAttrLen;
    public uint dwCompAttrOffset;
    public uint dwCompClauseLen;
    public uint dwCompClauseOffset;
    public uint dwCompStrLen;
    public uint dwCompStrOffset;
    public uint dwCursorPos;
    public uint dwDeltaStart;
    public uint dwResultReadClauseLen;
    public uint dwResultReadClauseOffset;
    public uint dwResultReadStrLen;
    public uint dwResultReadStrOffset;
    public uint dwResultClauseLen;
    public uint dwResultClauseOffset;
    public uint dwResultStrLen;
    public uint dwResultStrOffset;
    public uint dwPrivateSize;
    public uint dwPrivateOffset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COMPOSITIONSTRING
    Public dwSize As UInteger
    Public dwCompReadAttrLen As UInteger
    Public dwCompReadAttrOffset As UInteger
    Public dwCompReadClauseLen As UInteger
    Public dwCompReadClauseOffset As UInteger
    Public dwCompReadStrLen As UInteger
    Public dwCompReadStrOffset As UInteger
    Public dwCompAttrLen As UInteger
    Public dwCompAttrOffset As UInteger
    Public dwCompClauseLen As UInteger
    Public dwCompClauseOffset As UInteger
    Public dwCompStrLen As UInteger
    Public dwCompStrOffset As UInteger
    Public dwCursorPos As UInteger
    Public dwDeltaStart As UInteger
    Public dwResultReadClauseLen As UInteger
    Public dwResultReadClauseOffset As UInteger
    Public dwResultReadStrLen As UInteger
    Public dwResultReadStrOffset As UInteger
    Public dwResultClauseLen As UInteger
    Public dwResultClauseOffset As UInteger
    Public dwResultStrLen As UInteger
    Public dwResultStrOffset As UInteger
    Public dwPrivateSize As UInteger
    Public dwPrivateOffset As UInteger
End Structure
import ctypes
from ctypes import wintypes

class COMPOSITIONSTRING(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwCompReadAttrLen", wintypes.DWORD),
        ("dwCompReadAttrOffset", wintypes.DWORD),
        ("dwCompReadClauseLen", wintypes.DWORD),
        ("dwCompReadClauseOffset", wintypes.DWORD),
        ("dwCompReadStrLen", wintypes.DWORD),
        ("dwCompReadStrOffset", wintypes.DWORD),
        ("dwCompAttrLen", wintypes.DWORD),
        ("dwCompAttrOffset", wintypes.DWORD),
        ("dwCompClauseLen", wintypes.DWORD),
        ("dwCompClauseOffset", wintypes.DWORD),
        ("dwCompStrLen", wintypes.DWORD),
        ("dwCompStrOffset", wintypes.DWORD),
        ("dwCursorPos", wintypes.DWORD),
        ("dwDeltaStart", wintypes.DWORD),
        ("dwResultReadClauseLen", wintypes.DWORD),
        ("dwResultReadClauseOffset", wintypes.DWORD),
        ("dwResultReadStrLen", wintypes.DWORD),
        ("dwResultReadStrOffset", wintypes.DWORD),
        ("dwResultClauseLen", wintypes.DWORD),
        ("dwResultClauseOffset", wintypes.DWORD),
        ("dwResultStrLen", wintypes.DWORD),
        ("dwResultStrOffset", wintypes.DWORD),
        ("dwPrivateSize", wintypes.DWORD),
        ("dwPrivateOffset", wintypes.DWORD),
    ]
#[repr(C)]
pub struct COMPOSITIONSTRING {
    pub dwSize: u32,
    pub dwCompReadAttrLen: u32,
    pub dwCompReadAttrOffset: u32,
    pub dwCompReadClauseLen: u32,
    pub dwCompReadClauseOffset: u32,
    pub dwCompReadStrLen: u32,
    pub dwCompReadStrOffset: u32,
    pub dwCompAttrLen: u32,
    pub dwCompAttrOffset: u32,
    pub dwCompClauseLen: u32,
    pub dwCompClauseOffset: u32,
    pub dwCompStrLen: u32,
    pub dwCompStrOffset: u32,
    pub dwCursorPos: u32,
    pub dwDeltaStart: u32,
    pub dwResultReadClauseLen: u32,
    pub dwResultReadClauseOffset: u32,
    pub dwResultReadStrLen: u32,
    pub dwResultReadStrOffset: u32,
    pub dwResultClauseLen: u32,
    pub dwResultClauseOffset: u32,
    pub dwResultStrLen: u32,
    pub dwResultStrOffset: u32,
    pub dwPrivateSize: u32,
    pub dwPrivateOffset: u32,
}
import "golang.org/x/sys/windows"

type COMPOSITIONSTRING struct {
	dwSize uint32
	dwCompReadAttrLen uint32
	dwCompReadAttrOffset uint32
	dwCompReadClauseLen uint32
	dwCompReadClauseOffset uint32
	dwCompReadStrLen uint32
	dwCompReadStrOffset uint32
	dwCompAttrLen uint32
	dwCompAttrOffset uint32
	dwCompClauseLen uint32
	dwCompClauseOffset uint32
	dwCompStrLen uint32
	dwCompStrOffset uint32
	dwCursorPos uint32
	dwDeltaStart uint32
	dwResultReadClauseLen uint32
	dwResultReadClauseOffset uint32
	dwResultReadStrLen uint32
	dwResultReadStrOffset uint32
	dwResultClauseLen uint32
	dwResultClauseOffset uint32
	dwResultStrLen uint32
	dwResultStrOffset uint32
	dwPrivateSize uint32
	dwPrivateOffset uint32
}
type
  COMPOSITIONSTRING = record
    dwSize: DWORD;
    dwCompReadAttrLen: DWORD;
    dwCompReadAttrOffset: DWORD;
    dwCompReadClauseLen: DWORD;
    dwCompReadClauseOffset: DWORD;
    dwCompReadStrLen: DWORD;
    dwCompReadStrOffset: DWORD;
    dwCompAttrLen: DWORD;
    dwCompAttrOffset: DWORD;
    dwCompClauseLen: DWORD;
    dwCompClauseOffset: DWORD;
    dwCompStrLen: DWORD;
    dwCompStrOffset: DWORD;
    dwCursorPos: DWORD;
    dwDeltaStart: DWORD;
    dwResultReadClauseLen: DWORD;
    dwResultReadClauseOffset: DWORD;
    dwResultReadStrLen: DWORD;
    dwResultReadStrOffset: DWORD;
    dwResultClauseLen: DWORD;
    dwResultClauseOffset: DWORD;
    dwResultStrLen: DWORD;
    dwResultStrOffset: DWORD;
    dwPrivateSize: DWORD;
    dwPrivateOffset: DWORD;
  end;
const COMPOSITIONSTRING = extern struct {
    dwSize: u32,
    dwCompReadAttrLen: u32,
    dwCompReadAttrOffset: u32,
    dwCompReadClauseLen: u32,
    dwCompReadClauseOffset: u32,
    dwCompReadStrLen: u32,
    dwCompReadStrOffset: u32,
    dwCompAttrLen: u32,
    dwCompAttrOffset: u32,
    dwCompClauseLen: u32,
    dwCompClauseOffset: u32,
    dwCompStrLen: u32,
    dwCompStrOffset: u32,
    dwCursorPos: u32,
    dwDeltaStart: u32,
    dwResultReadClauseLen: u32,
    dwResultReadClauseOffset: u32,
    dwResultReadStrLen: u32,
    dwResultReadStrOffset: u32,
    dwResultClauseLen: u32,
    dwResultClauseOffset: u32,
    dwResultStrLen: u32,
    dwResultStrOffset: u32,
    dwPrivateSize: u32,
    dwPrivateOffset: u32,
};
type
  COMPOSITIONSTRING {.bycopy.} = object
    dwSize: uint32
    dwCompReadAttrLen: uint32
    dwCompReadAttrOffset: uint32
    dwCompReadClauseLen: uint32
    dwCompReadClauseOffset: uint32
    dwCompReadStrLen: uint32
    dwCompReadStrOffset: uint32
    dwCompAttrLen: uint32
    dwCompAttrOffset: uint32
    dwCompClauseLen: uint32
    dwCompClauseOffset: uint32
    dwCompStrLen: uint32
    dwCompStrOffset: uint32
    dwCursorPos: uint32
    dwDeltaStart: uint32
    dwResultReadClauseLen: uint32
    dwResultReadClauseOffset: uint32
    dwResultReadStrLen: uint32
    dwResultReadStrOffset: uint32
    dwResultClauseLen: uint32
    dwResultClauseOffset: uint32
    dwResultStrLen: uint32
    dwResultStrOffset: uint32
    dwPrivateSize: uint32
    dwPrivateOffset: uint32
struct COMPOSITIONSTRING
{
    uint dwSize;
    uint dwCompReadAttrLen;
    uint dwCompReadAttrOffset;
    uint dwCompReadClauseLen;
    uint dwCompReadClauseOffset;
    uint dwCompReadStrLen;
    uint dwCompReadStrOffset;
    uint dwCompAttrLen;
    uint dwCompAttrOffset;
    uint dwCompClauseLen;
    uint dwCompClauseOffset;
    uint dwCompStrLen;
    uint dwCompStrOffset;
    uint dwCursorPos;
    uint dwDeltaStart;
    uint dwResultReadClauseLen;
    uint dwResultReadClauseOffset;
    uint dwResultReadStrLen;
    uint dwResultReadStrOffset;
    uint dwResultClauseLen;
    uint dwResultClauseOffset;
    uint dwResultStrLen;
    uint dwResultStrOffset;
    uint dwPrivateSize;
    uint dwPrivateOffset;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COMPOSITIONSTRING サイズ: 100 バイト(x64)
dim st, 25    ; 4byte整数×25(構造体サイズ 100 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwCompReadAttrLen : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwCompReadAttrOffset : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwCompReadClauseLen : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwCompReadClauseOffset : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwCompReadStrLen : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwCompReadStrOffset : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwCompAttrLen : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwCompAttrOffset : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwCompClauseLen : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwCompClauseOffset : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwCompStrLen : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwCompStrOffset : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwCursorPos : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; dwDeltaStart : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; dwResultReadClauseLen : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; dwResultReadClauseOffset : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; dwResultReadStrLen : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; dwResultReadStrOffset : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; dwResultClauseLen : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; dwResultClauseOffset : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; dwResultStrLen : DWORD (+84, 4byte)  st.21 = 値  /  値 = st.21   (lpoke/lpeek も可)
; dwResultStrOffset : DWORD (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; dwPrivateSize : DWORD (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; dwPrivateOffset : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global COMPOSITIONSTRING
    #field int dwSize
    #field int dwCompReadAttrLen
    #field int dwCompReadAttrOffset
    #field int dwCompReadClauseLen
    #field int dwCompReadClauseOffset
    #field int dwCompReadStrLen
    #field int dwCompReadStrOffset
    #field int dwCompAttrLen
    #field int dwCompAttrOffset
    #field int dwCompClauseLen
    #field int dwCompClauseOffset
    #field int dwCompStrLen
    #field int dwCompStrOffset
    #field int dwCursorPos
    #field int dwDeltaStart
    #field int dwResultReadClauseLen
    #field int dwResultReadClauseOffset
    #field int dwResultReadStrLen
    #field int dwResultReadStrOffset
    #field int dwResultClauseLen
    #field int dwResultClauseOffset
    #field int dwResultStrLen
    #field int dwResultStrOffset
    #field int dwPrivateSize
    #field int dwPrivateOffset
#endstruct

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