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

ReplaceTextW

関数
文字列置換の非モーダルダイアログを表示する(Unicode版)。
DLLCOMDLG32.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// COMDLG32.dll  (Unicode / -W)
#include <windows.h>

HWND ReplaceTextW(
    FINDREPLACEW* param0
);

パラメーター

名前方向
param0FINDREPLACEW*inout

戻り値の型: HWND

各言語での呼び出し定義

// COMDLG32.dll  (Unicode / -W)
#include <windows.h>

HWND ReplaceTextW(
    FINDREPLACEW* param0
);
[DllImport("COMDLG32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr ReplaceTextW(
    IntPtr param0   // FINDREPLACEW* in/out
);
<DllImport("COMDLG32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function ReplaceTextW(
    param0 As IntPtr   ' FINDREPLACEW* in/out
) As IntPtr
End Function
' param0 : FINDREPLACEW* in/out
Declare PtrSafe Function ReplaceTextW Lib "comdlg32" ( _
    ByVal param0 As LongPtr) As LongPtr
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ReplaceTextW = ctypes.windll.comdlg32.ReplaceTextW
ReplaceTextW.restype = ctypes.c_void_p
ReplaceTextW.argtypes = [
    ctypes.c_void_p,  # param0 : FINDREPLACEW* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('COMDLG32.dll')
ReplaceTextW = Fiddle::Function.new(
  lib['ReplaceTextW'],
  [
    Fiddle::TYPE_VOIDP,  # param0 : FINDREPLACEW* in/out
  ],
  Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "comdlg32")]
extern "system" {
    fn ReplaceTextW(
        param0: *mut FINDREPLACEW  // FINDREPLACEW* in/out
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("COMDLG32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr ReplaceTextW(IntPtr param0);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMDLG32_ReplaceTextW' -Namespace Win32 -PassThru
# $api::ReplaceTextW(param0)
#uselib "COMDLG32.dll"
#func global ReplaceTextW "ReplaceTextW" wptr
; ReplaceTextW varptr(param0)   ; 戻り値は stat
; param0 : FINDREPLACEW* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "COMDLG32.dll"
#cfunc global ReplaceTextW "ReplaceTextW" var
; res = ReplaceTextW(param0)
; param0 : FINDREPLACEW* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HWND ReplaceTextW(FINDREPLACEW* param0)
#uselib "COMDLG32.dll"
#cfunc global ReplaceTextW "ReplaceTextW" var
; res = ReplaceTextW(param0)
; param0 : FINDREPLACEW* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comdlg32 = windows.NewLazySystemDLL("COMDLG32.dll")
	procReplaceTextW = comdlg32.NewProc("ReplaceTextW")
)

// param0 (FINDREPLACEW* in/out)
r1, _, err := procReplaceTextW.Call(
	uintptr(param0),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HWND
function ReplaceTextW(
  param0: Pointer   // FINDREPLACEW* in/out
): THandle; stdcall;
  external 'COMDLG32.dll' name 'ReplaceTextW';
result := DllCall("COMDLG32\ReplaceTextW"
    , "Ptr", param0   ; FINDREPLACEW* in/out
    , "Ptr")   ; return: HWND
●ReplaceTextW(param0) = DLL("COMDLG32.dll", "void* ReplaceTextW(void*)")
# 呼び出し: ReplaceTextW(param0)
# param0 : FINDREPLACEW* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。