ホーム › UI.Controls.Dialogs › FINDREPLACEW
FINDREPLACEW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| lStructSize | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で指定する。FindTextW/ReplaceTextW呼び出し前に設定する。 |
| hwndOwner | HWND | 8/4 | +4 | +4 | ダイアログを所有しメッセージを受け取る親ウィンドウのハンドル。NULL不可。 |
| hInstance | HINSTANCE | 8/4 | +12 | +8 | カスタムテンプレートを含むモジュールのインスタンスハンドル。 |
| Flags | FINDREPLACE_FLAGS | 4 | +20 | +12 | 検索方向や大小区別などを制御するFR_系フラグの組み合わせ。 |
| lpstrFindWhat | LPWSTR | 8/4 | +24 | +16 | 検索する文字列を保持するバッファ。 |
| lpstrReplaceWith | LPWSTR | 8/4 | +32 | +20 | 置換後の文字列を保持するバッファ。ReplaceTextで使われる。 |
| wFindWhatLen | WORD | 2 | +40 | +24 | lpstrFindWhatバッファのサイズをバイト単位で指定する。 |
| wReplaceWithLen | WORD | 2 | +42 | +26 | lpstrReplaceWithバッファのサイズをバイト単位で指定する。 |
| lCustData | LPARAM | 8/4 | +44 | +28 | フックプロシージャに渡されるアプリケーション定義データ。 |
| lpfnHook | LPFRHOOKPROC | 8/4 | +52 | +32 | メッセージを処理するフックプロシージャへのポインタ。FR_ENABLEHOOK時に有効。 |
| lpTemplateName | LPWSTR | 8/4 | +60 | +36 | FR_ENABLETEMPLATE指定時のダイアログテンプレートのリソース名。 |
各言語での定義
#include <windows.h>
// FINDREPLACEW (x64 68 / x86 40 バイト)
#pragma pack(push, 1)
typedef struct FINDREPLACEW {
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
FINDREPLACE_FLAGS Flags;
LPWSTR lpstrFindWhat;
LPWSTR lpstrReplaceWith;
WORD wFindWhatLen;
WORD wReplaceWithLen;
LPARAM lCustData;
LPFRHOOKPROC lpfnHook;
LPWSTR lpTemplateName;
} FINDREPLACEW;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct FINDREPLACEW
{
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 FINDREPLACEW
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 Structureimport ctypes
from ctypes import wintypes
class FINDREPLACEW(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 FINDREPLACEW {
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 FINDREPLACEW struct {
lStructSize uint32
hwndOwner uintptr
hInstance uintptr
Flags uint32
lpstrFindWhat uintptr
lpstrReplaceWith uintptr
wFindWhatLen uint16
wReplaceWithLen uint16
lCustData uintptr
lpfnHook uintptr
lpTemplateName uintptr
}type
FINDREPLACEW = 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 FINDREPLACEW = 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
FINDREPLACEW {.packed.} = object
lStructSize: uint32
hwndOwner: pointer
hInstance: pointer
Flags: uint32
lpstrFindWhat: pointer
lpstrReplaceWith: pointer
wFindWhatLen: uint16
wReplaceWithLen: uint16
lCustData: int
lpfnHook: pointer
lpTemplateName: pointeralign(1)
struct FINDREPLACEW
{
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 レイアウト)
; FINDREPLACEW サイズ: 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 : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; lpstrReplaceWith : LPWSTR (+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 : LPWSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FINDREPLACEW サイズ: 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 : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; lpstrReplaceWith : LPWSTR (+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 : LPWSTR (+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 FINDREPLACEW, 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, FINDREPLACEW ; NSTRUCT 変数を確保
st->lStructSize = 100
mes "lStructSize=" + st->lStructSize