ホーム › UI.Controls › Str_SetPtrW
Str_SetPtrW
関数文字列ポインタの内容を割り当てて複製する(Unicode版)。
シグネチャ
// COMCTL32.dll
#include <windows.h>
BOOL Str_SetPtrW(
LPWSTR* ppsz,
LPCWSTR psz // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ppsz | LPWSTR* | inout |
| psz | LPCWSTR | inoptional |
戻り値の型: BOOL
各言語での呼び出し定義
// COMCTL32.dll
#include <windows.h>
BOOL Str_SetPtrW(
LPWSTR* ppsz,
LPCWSTR psz // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("COMCTL32.dll", ExactSpelling = true)]
static extern bool Str_SetPtrW(
IntPtr ppsz, // LPWSTR* in/out
[MarshalAs(UnmanagedType.LPWStr)] string psz // LPCWSTR optional
);<DllImport("COMCTL32.dll", ExactSpelling:=True)>
Public Shared Function Str_SetPtrW(
ppsz As IntPtr, ' LPWSTR* in/out
<MarshalAs(UnmanagedType.LPWStr)> psz As String ' LPCWSTR optional
) As Boolean
End Function' ppsz : LPWSTR* in/out
' psz : LPCWSTR optional
Declare PtrSafe Function Str_SetPtrW Lib "comctl32" ( _
ByVal ppsz As LongPtr, _
ByVal psz As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
Str_SetPtrW = ctypes.windll.comctl32.Str_SetPtrW
Str_SetPtrW.restype = wintypes.BOOL
Str_SetPtrW.argtypes = [
ctypes.c_void_p, # ppsz : LPWSTR* in/out
wintypes.LPCWSTR, # psz : LPCWSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('COMCTL32.dll')
Str_SetPtrW = Fiddle::Function.new(
lib['Str_SetPtrW'],
[
Fiddle::TYPE_VOIDP, # ppsz : LPWSTR* in/out
Fiddle::TYPE_VOIDP, # psz : LPCWSTR optional
],
Fiddle::TYPE_INT)#[link(name = "comctl32")]
extern "system" {
fn Str_SetPtrW(
ppsz: *mut *mut u16, // LPWSTR* in/out
psz: *const u16 // LPCWSTR optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("COMCTL32.dll")]
public static extern bool Str_SetPtrW(IntPtr ppsz, [MarshalAs(UnmanagedType.LPWStr)] string psz);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_Str_SetPtrW' -Namespace Win32 -PassThru
# $api::Str_SetPtrW(ppsz, psz)#uselib "COMCTL32.dll"
#func global Str_SetPtrW "Str_SetPtrW" sptr, sptr
; Str_SetPtrW varptr(ppsz), psz ; 戻り値は stat
; ppsz : LPWSTR* in/out -> "sptr"
; psz : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "COMCTL32.dll" #cfunc global Str_SetPtrW "Str_SetPtrW" var, wstr ; res = Str_SetPtrW(ppsz, psz) ; ppsz : LPWSTR* in/out -> "var" ; psz : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "COMCTL32.dll" #cfunc global Str_SetPtrW "Str_SetPtrW" sptr, wstr ; res = Str_SetPtrW(varptr(ppsz), psz) ; ppsz : LPWSTR* in/out -> "sptr" ; psz : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL Str_SetPtrW(LPWSTR* ppsz, LPCWSTR psz) #uselib "COMCTL32.dll" #cfunc global Str_SetPtrW "Str_SetPtrW" var, wstr ; res = Str_SetPtrW(ppsz, psz) ; ppsz : LPWSTR* in/out -> "var" ; psz : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL Str_SetPtrW(LPWSTR* ppsz, LPCWSTR psz) #uselib "COMCTL32.dll" #cfunc global Str_SetPtrW "Str_SetPtrW" intptr, wstr ; res = Str_SetPtrW(varptr(ppsz), psz) ; ppsz : LPWSTR* in/out -> "intptr" ; psz : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
procStr_SetPtrW = comctl32.NewProc("Str_SetPtrW")
)
// ppsz (LPWSTR* in/out), psz (LPCWSTR optional)
r1, _, err := procStr_SetPtrW.Call(
uintptr(ppsz),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(psz))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction Str_SetPtrW(
ppsz: PPWideChar; // LPWSTR* in/out
psz: PWideChar // LPCWSTR optional
): BOOL; stdcall;
external 'COMCTL32.dll' name 'Str_SetPtrW';result := DllCall("COMCTL32\Str_SetPtrW"
, "Ptr", ppsz ; LPWSTR* in/out
, "WStr", psz ; LPCWSTR optional
, "Int") ; return: BOOL●Str_SetPtrW(ppsz, psz) = DLL("COMCTL32.dll", "bool Str_SetPtrW(void*, char*)")
# 呼び出し: Str_SetPtrW(ppsz, psz)
# ppsz : LPWSTR* in/out -> "void*"
# psz : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。