Win32 API 日本語リファレンス
ホームUI.TextServices › TS_TEXTCHANGE

TS_TEXTCHANGE

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

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

フィールド

フィールドサイズx64x86説明
acpStartINT4+0+0変更されたテキスト範囲の開始文字位置(ACP)。
acpOldEndINT4+4+4変更前のテキスト範囲の終了文字位置(ACP)。
acpNewEndINT4+8+8変更後のテキスト範囲の終了文字位置(ACP)。

各言語での定義

#include <windows.h>

// TS_TEXTCHANGE  (x64 12 / x86 12 バイト)
typedef struct TS_TEXTCHANGE {
    INT acpStart;
    INT acpOldEnd;
    INT acpNewEnd;
} TS_TEXTCHANGE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TS_TEXTCHANGE
{
    public int acpStart;
    public int acpOldEnd;
    public int acpNewEnd;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TS_TEXTCHANGE
    Public acpStart As Integer
    Public acpOldEnd As Integer
    Public acpNewEnd As Integer
End Structure
import ctypes
from ctypes import wintypes

class TS_TEXTCHANGE(ctypes.Structure):
    _fields_ = [
        ("acpStart", ctypes.c_int),
        ("acpOldEnd", ctypes.c_int),
        ("acpNewEnd", ctypes.c_int),
    ]
#[repr(C)]
pub struct TS_TEXTCHANGE {
    pub acpStart: i32,
    pub acpOldEnd: i32,
    pub acpNewEnd: i32,
}
import "golang.org/x/sys/windows"

type TS_TEXTCHANGE struct {
	acpStart int32
	acpOldEnd int32
	acpNewEnd int32
}
type
  TS_TEXTCHANGE = record
    acpStart: Integer;
    acpOldEnd: Integer;
    acpNewEnd: Integer;
  end;
const TS_TEXTCHANGE = extern struct {
    acpStart: i32,
    acpOldEnd: i32,
    acpNewEnd: i32,
};
type
  TS_TEXTCHANGE {.bycopy.} = object
    acpStart: int32
    acpOldEnd: int32
    acpNewEnd: int32
struct TS_TEXTCHANGE
{
    int acpStart;
    int acpOldEnd;
    int acpNewEnd;
}

HSP用 定義

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

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

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