Win32 API 日本語リファレンス
ホームSystem.AddressBook › ScDupPropset

ScDupPropset

関数
プロパティ値配列を複製して新しいバッファに格納する。
DLLMAPI32.dll呼出規約winapi

シグネチャ

// MAPI32.dll
#include <windows.h>

INT ScDupPropset(
    INT cValues,
    SPropValue* lpPropArray,
    LPALLOCATEBUFFER lpAllocateBuffer,
    SPropValue** lppPropArray
);

パラメーター

名前方向
cValuesINTin
lpPropArraySPropValue*inout
lpAllocateBufferLPALLOCATEBUFFERin
lppPropArraySPropValue**inout

戻り値の型: INT

各言語での呼び出し定義

// MAPI32.dll
#include <windows.h>

INT ScDupPropset(
    INT cValues,
    SPropValue* lpPropArray,
    LPALLOCATEBUFFER lpAllocateBuffer,
    SPropValue** lppPropArray
);
[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern int ScDupPropset(
    int cValues,   // INT
    IntPtr lpPropArray,   // SPropValue* in/out
    IntPtr lpAllocateBuffer,   // LPALLOCATEBUFFER
    IntPtr lppPropArray   // SPropValue** in/out
);
<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function ScDupPropset(
    cValues As Integer,   ' INT
    lpPropArray As IntPtr,   ' SPropValue* in/out
    lpAllocateBuffer As IntPtr,   ' LPALLOCATEBUFFER
    lppPropArray As IntPtr   ' SPropValue** in/out
) As Integer
End Function
' cValues : INT
' lpPropArray : SPropValue* in/out
' lpAllocateBuffer : LPALLOCATEBUFFER
' lppPropArray : SPropValue** in/out
Declare PtrSafe Function ScDupPropset Lib "mapi32" ( _
    ByVal cValues As Long, _
    ByVal lpPropArray As LongPtr, _
    ByVal lpAllocateBuffer As LongPtr, _
    ByVal lppPropArray As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ScDupPropset = ctypes.windll.mapi32.ScDupPropset
ScDupPropset.restype = ctypes.c_int
ScDupPropset.argtypes = [
    ctypes.c_int,  # cValues : INT
    ctypes.c_void_p,  # lpPropArray : SPropValue* in/out
    ctypes.c_void_p,  # lpAllocateBuffer : LPALLOCATEBUFFER
    ctypes.c_void_p,  # lppPropArray : SPropValue** in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MAPI32.dll')
ScDupPropset = Fiddle::Function.new(
  lib['ScDupPropset'],
  [
    Fiddle::TYPE_INT,  # cValues : INT
    Fiddle::TYPE_VOIDP,  # lpPropArray : SPropValue* in/out
    Fiddle::TYPE_VOIDP,  # lpAllocateBuffer : LPALLOCATEBUFFER
    Fiddle::TYPE_VOIDP,  # lppPropArray : SPropValue** in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mapi32")]
extern "system" {
    fn ScDupPropset(
        cValues: i32,  // INT
        lpPropArray: *mut SPropValue,  // SPropValue* in/out
        lpAllocateBuffer: *const core::ffi::c_void,  // LPALLOCATEBUFFER
        lppPropArray: *mut *mut SPropValue  // SPropValue** in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MAPI32.dll")]
public static extern int ScDupPropset(int cValues, IntPtr lpPropArray, IntPtr lpAllocateBuffer, IntPtr lppPropArray);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_ScDupPropset' -Namespace Win32 -PassThru
# $api::ScDupPropset(cValues, lpPropArray, lpAllocateBuffer, lppPropArray)
#uselib "MAPI32.dll"
#func global ScDupPropset "ScDupPropset" sptr, sptr, sptr, sptr
; ScDupPropset cValues, varptr(lpPropArray), lpAllocateBuffer, varptr(lppPropArray)   ; 戻り値は stat
; cValues : INT -> "sptr"
; lpPropArray : SPropValue* in/out -> "sptr"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "sptr"
; lppPropArray : SPropValue** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MAPI32.dll"
#cfunc global ScDupPropset "ScDupPropset" int, var, sptr, var
; res = ScDupPropset(cValues, lpPropArray, lpAllocateBuffer, lppPropArray)
; cValues : INT -> "int"
; lpPropArray : SPropValue* in/out -> "var"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "sptr"
; lppPropArray : SPropValue** in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT ScDupPropset(INT cValues, SPropValue* lpPropArray, LPALLOCATEBUFFER lpAllocateBuffer, SPropValue** lppPropArray)
#uselib "MAPI32.dll"
#cfunc global ScDupPropset "ScDupPropset" int, var, intptr, var
; res = ScDupPropset(cValues, lpPropArray, lpAllocateBuffer, lppPropArray)
; cValues : INT -> "int"
; lpPropArray : SPropValue* in/out -> "var"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "intptr"
; lppPropArray : SPropValue** in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
	procScDupPropset = mapi32.NewProc("ScDupPropset")
)

// cValues (INT), lpPropArray (SPropValue* in/out), lpAllocateBuffer (LPALLOCATEBUFFER), lppPropArray (SPropValue** in/out)
r1, _, err := procScDupPropset.Call(
	uintptr(cValues),
	uintptr(lpPropArray),
	uintptr(lpAllocateBuffer),
	uintptr(lppPropArray),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function ScDupPropset(
  cValues: Integer;   // INT
  lpPropArray: Pointer;   // SPropValue* in/out
  lpAllocateBuffer: Pointer;   // LPALLOCATEBUFFER
  lppPropArray: Pointer   // SPropValue** in/out
): Integer; stdcall;
  external 'MAPI32.dll' name 'ScDupPropset';
result := DllCall("MAPI32\ScDupPropset"
    , "Int", cValues   ; INT
    , "Ptr", lpPropArray   ; SPropValue* in/out
    , "Ptr", lpAllocateBuffer   ; LPALLOCATEBUFFER
    , "Ptr", lppPropArray   ; SPropValue** in/out
    , "Int")   ; return: INT
●ScDupPropset(cValues, lpPropArray, lpAllocateBuffer, lppPropArray) = DLL("MAPI32.dll", "int ScDupPropset(int, void*, void*, void*)")
# 呼び出し: ScDupPropset(cValues, lpPropArray, lpAllocateBuffer, lppPropArray)
# cValues : INT -> "int"
# lpPropArray : SPropValue* in/out -> "void*"
# lpAllocateBuffer : LPALLOCATEBUFFER -> "void*"
# lppPropArray : SPropValue** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。