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

FINDREPLACEA

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

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

フィールド

フィールドサイズx64x86説明
lStructSizeDWORD4+0+0この構造体のサイズをバイト単位で指定する。FindTextA/ReplaceTextA呼び出し前に設定する。
hwndOwnerHWND8/4+4+4ダイアログを所有しメッセージを受け取る親ウィンドウのハンドル。NULL不可。
hInstanceHINSTANCE8/4+12+8カスタムテンプレートを含むモジュールのインスタンスハンドル。
FlagsFINDREPLACE_FLAGS4+20+12検索方向や大小区別などを制御するFR_系フラグの組み合わせ。
lpstrFindWhatLPSTR8/4+24+16検索する文字列を保持するバッファ。
lpstrReplaceWithLPSTR8/4+32+20置換後の文字列を保持するバッファ。ReplaceTextで使われる。
wFindWhatLenWORD2+40+24lpstrFindWhatバッファのサイズをバイト単位で指定する。
wReplaceWithLenWORD2+42+26lpstrReplaceWithバッファのサイズをバイト単位で指定する。
lCustDataLPARAM8/4+44+28フックプロシージャに渡されるアプリケーション定義データ。
lpfnHookLPFRHOOKPROC8/4+52+32メッセージを処理するフックプロシージャへのポインタ。FR_ENABLEHOOK時に有効。
lpTemplateNameLPSTR8/4+60+36FR_ENABLETEMPLATE指定時のダイアログテンプレートのリソース名。

各言語での定義

#include <windows.h>

// FINDREPLACEA  (x64 68 / x86 40 バイト)
#pragma pack(push, 1)
typedef struct FINDREPLACEA {
    DWORD lStructSize;
    HWND hwndOwner;
    HINSTANCE hInstance;
    FINDREPLACE_FLAGS Flags;
    LPSTR lpstrFindWhat;
    LPSTR lpstrReplaceWith;
    WORD wFindWhatLen;
    WORD wReplaceWithLen;
    LPARAM lCustData;
    LPFRHOOKPROC lpfnHook;
    LPSTR lpTemplateName;
} FINDREPLACEA;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct FINDREPLACEA
{
    public uint lStructSize;
    public IntPtr hwndOwner;
    public IntPtr hInstance;
    public uint Flags;
    public IntPtr lpstrFindWhat;
    public IntPtr lpstrReplaceWith;
    public ushort wFindWhatLen;
    public ushort wReplaceWithLen;
    public IntPtr lCustData;
    public IntPtr lpfnHook;
    public IntPtr lpTemplateName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure FINDREPLACEA
    Public lStructSize As UInteger
    Public hwndOwner As IntPtr
    Public hInstance As IntPtr
    Public Flags As UInteger
    Public lpstrFindWhat As IntPtr
    Public lpstrReplaceWith As IntPtr
    Public wFindWhatLen As UShort
    Public wReplaceWithLen As UShort
    Public lCustData As IntPtr
    Public lpfnHook As IntPtr
    Public lpTemplateName As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class FINDREPLACEA(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("lStructSize", wintypes.DWORD),
        ("hwndOwner", ctypes.c_void_p),
        ("hInstance", ctypes.c_void_p),
        ("Flags", wintypes.DWORD),
        ("lpstrFindWhat", ctypes.c_void_p),
        ("lpstrReplaceWith", ctypes.c_void_p),
        ("wFindWhatLen", ctypes.c_ushort),
        ("wReplaceWithLen", ctypes.c_ushort),
        ("lCustData", ctypes.c_ssize_t),
        ("lpfnHook", ctypes.c_void_p),
        ("lpTemplateName", ctypes.c_void_p),
    ]
#[repr(C, packed(1))]
pub struct FINDREPLACEA {
    pub lStructSize: u32,
    pub hwndOwner: *mut core::ffi::c_void,
    pub hInstance: *mut core::ffi::c_void,
    pub Flags: u32,
    pub lpstrFindWhat: *mut core::ffi::c_void,
    pub lpstrReplaceWith: *mut core::ffi::c_void,
    pub wFindWhatLen: u16,
    pub wReplaceWithLen: u16,
    pub lCustData: isize,
    pub lpfnHook: *mut core::ffi::c_void,
    pub lpTemplateName: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type FINDREPLACEA struct {
	lStructSize uint32
	hwndOwner uintptr
	hInstance uintptr
	Flags uint32
	lpstrFindWhat uintptr
	lpstrReplaceWith uintptr
	wFindWhatLen uint16
	wReplaceWithLen uint16
	lCustData uintptr
	lpfnHook uintptr
	lpTemplateName uintptr
}
type
  FINDREPLACEA = packed record
    lStructSize: DWORD;
    hwndOwner: Pointer;
    hInstance: Pointer;
    Flags: DWORD;
    lpstrFindWhat: Pointer;
    lpstrReplaceWith: Pointer;
    wFindWhatLen: Word;
    wReplaceWithLen: Word;
    lCustData: NativeInt;
    lpfnHook: Pointer;
    lpTemplateName: Pointer;
  end;
const FINDREPLACEA = extern struct {
    lStructSize: u32,
    hwndOwner: ?*anyopaque,
    hInstance: ?*anyopaque,
    Flags: u32,
    lpstrFindWhat: ?*anyopaque,
    lpstrReplaceWith: ?*anyopaque,
    wFindWhatLen: u16,
    wReplaceWithLen: u16,
    lCustData: isize,
    lpfnHook: ?*anyopaque,
    lpTemplateName: ?*anyopaque,
};
type
  FINDREPLACEA {.packed.} = object
    lStructSize: uint32
    hwndOwner: pointer
    hInstance: pointer
    Flags: uint32
    lpstrFindWhat: pointer
    lpstrReplaceWith: pointer
    wFindWhatLen: uint16
    wReplaceWithLen: uint16
    lCustData: int
    lpfnHook: pointer
    lpTemplateName: pointer
align(1)
struct FINDREPLACEA
{
    uint lStructSize;
    void* hwndOwner;
    void* hInstance;
    uint Flags;
    void* lpstrFindWhat;
    void* lpstrReplaceWith;
    ushort wFindWhatLen;
    ushort wReplaceWithLen;
    ptrdiff_t lCustData;
    void* lpfnHook;
    void* lpTemplateName;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; FINDREPLACEA サイズ: 40 バイト(x86)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; lStructSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hwndOwner : HWND (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; hInstance : HINSTANCE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Flags : FINDREPLACE_FLAGS (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lpstrFindWhat : LPSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; lpstrReplaceWith : LPSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; wFindWhatLen : WORD (+24, 2byte)  wpoke st,24,値  /  値 = wpeek(st,24)
; wReplaceWithLen : WORD (+26, 2byte)  wpoke st,26,値  /  値 = wpeek(st,26)
; lCustData : LPARAM (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; lpfnHook : LPFRHOOKPROC (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; lpTemplateName : LPSTR (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FINDREPLACEA サイズ: 68 バイト(x64)
dim st, 17    ; 4byte整数×17(構造体サイズ 68 / 4 切り上げ)
; lStructSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hwndOwner : HWND (+4, 8byte)  qpoke st,4,値 / qpeek(st,4)  ※IronHSPのみ。3.7/3.8は lpoke st,4,下位 : lpoke st,8,上位
; hInstance : HINSTANCE (+12, 8byte)  qpoke st,12,値 / qpeek(st,12)  ※IronHSPのみ。3.7/3.8は lpoke st,12,下位 : lpoke st,16,上位
; Flags : FINDREPLACE_FLAGS (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; lpstrFindWhat : LPSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; lpstrReplaceWith : LPSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; wFindWhatLen : WORD (+40, 2byte)  wpoke st,40,値  /  値 = wpeek(st,40)
; wReplaceWithLen : WORD (+42, 2byte)  wpoke st,42,値  /  値 = wpeek(st,42)
; lCustData : LPARAM (+44, 8byte)  qpoke st,44,値 / qpeek(st,44)  ※IronHSPのみ。3.7/3.8は lpoke st,44,下位 : lpoke st,48,上位
; lpfnHook : LPFRHOOKPROC (+52, 8byte)  qpoke st,52,値 / qpeek(st,52)  ※IronHSPのみ。3.7/3.8は lpoke st,52,下位 : lpoke st,56,上位
; lpTemplateName : LPSTR (+60, 8byte)  qpoke st,60,値 / qpeek(st,60)  ※IronHSPのみ。3.7/3.8は lpoke st,60,下位 : lpoke st,64,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FINDREPLACEA, pack=1
    #field int lStructSize
    #field intptr hwndOwner
    #field intptr hInstance
    #field int Flags
    #field intptr lpstrFindWhat
    #field intptr lpstrReplaceWith
    #field short wFindWhatLen
    #field short wReplaceWithLen
    #field intptr lCustData
    #field intptr lpfnHook
    #field intptr lpTemplateName
#endstruct

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