Win32 API 日本語リファレンス
ホームUI.Controls.RichEdit › FINDTEXTA

FINDTEXTA

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

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

フィールド

フィールドサイズx64x86説明
chrgCHARRANGE8+0+0検索対象とする文字範囲を指定するCHARRANGE。cpMin/cpMaxで開始終了位置を表す。
lpstrTextLPSTR8/4+8+8検索する文字列へのANSI文字列ポインタである。

各言語での定義

#include <windows.h>

// CHARRANGE  (x64 8 / x86 8 バイト)
typedef struct CHARRANGE {
    INT cpMin;
    INT cpMax;
} CHARRANGE;

// FINDTEXTA  (x64 16 / x86 12 バイト)
typedef struct FINDTEXTA {
    CHARRANGE chrg;
    LPSTR lpstrText;
} FINDTEXTA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CHARRANGE
{
    public int cpMin;
    public int cpMax;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FINDTEXTA
{
    public CHARRANGE chrg;
    public IntPtr lpstrText;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CHARRANGE
    Public cpMin As Integer
    Public cpMax As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FINDTEXTA
    Public chrg As CHARRANGE
    Public lpstrText As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class CHARRANGE(ctypes.Structure):
    _fields_ = [
        ("cpMin", ctypes.c_int),
        ("cpMax", ctypes.c_int),
    ]

class FINDTEXTA(ctypes.Structure):
    _fields_ = [
        ("chrg", CHARRANGE),
        ("lpstrText", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct CHARRANGE {
    pub cpMin: i32,
    pub cpMax: i32,
}

#[repr(C)]
pub struct FINDTEXTA {
    pub chrg: CHARRANGE,
    pub lpstrText: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type CHARRANGE struct {
	cpMin int32
	cpMax int32
}

type FINDTEXTA struct {
	chrg CHARRANGE
	lpstrText uintptr
}
type
  CHARRANGE = record
    cpMin: Integer;
    cpMax: Integer;
  end;

  FINDTEXTA = record
    chrg: CHARRANGE;
    lpstrText: Pointer;
  end;
const CHARRANGE = extern struct {
    cpMin: i32,
    cpMax: i32,
};

const FINDTEXTA = extern struct {
    chrg: CHARRANGE,
    lpstrText: ?*anyopaque,
};
type
  CHARRANGE {.bycopy.} = object
    cpMin: int32
    cpMax: int32

  FINDTEXTA {.bycopy.} = object
    chrg: CHARRANGE
    lpstrText: pointer
struct CHARRANGE
{
    int cpMin;
    int cpMax;
}

struct FINDTEXTA
{
    CHARRANGE chrg;
    void* lpstrText;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; FINDTEXTA サイズ: 12 バイト(x86)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; chrg : CHARRANGE (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; lpstrText : LPSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FINDTEXTA サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; chrg : CHARRANGE (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; lpstrText : LPSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CHARRANGE
    #field int cpMin
    #field int cpMax
#endstruct

#defstruct global FINDTEXTA
    #field CHARRANGE chrg
    #field intptr lpstrText
#endstruct

stdim st, FINDTEXTA        ; NSTRUCT 変数を確保