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

DPA_SaveStream

関数
動的ポインタ配列をストリームに保存する。
DLLCOMCTL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT DPA_SaveStream(
    HDPA hdpa,
    PFNDPASTREAM pfn,
    IStream* pstream,
    void* pvInstData   // optional
);

パラメーター

名前方向
hdpaHDPAin
pfnPFNDPASTREAMin
pstreamIStream*in
pvInstDatavoid*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DPA_SaveStream(
    HDPA hdpa,
    PFNDPASTREAM pfn,
    IStream* pstream,
    void* pvInstData   // optional
);
[DllImport("COMCTL32.dll", ExactSpelling = true)]
static extern int DPA_SaveStream(
    IntPtr hdpa,   // HDPA
    IntPtr pfn,   // PFNDPASTREAM
    IntPtr pstream,   // IStream*
    IntPtr pvInstData   // void* optional
);
<DllImport("COMCTL32.dll", ExactSpelling:=True)>
Public Shared Function DPA_SaveStream(
    hdpa As IntPtr,   ' HDPA
    pfn As IntPtr,   ' PFNDPASTREAM
    pstream As IntPtr,   ' IStream*
    pvInstData As IntPtr   ' void* optional
) As Integer
End Function
' hdpa : HDPA
' pfn : PFNDPASTREAM
' pstream : IStream*
' pvInstData : void* optional
Declare PtrSafe Function DPA_SaveStream Lib "comctl32" ( _
    ByVal hdpa As LongPtr, _
    ByVal pfn As LongPtr, _
    ByVal pstream As LongPtr, _
    ByVal pvInstData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DPA_SaveStream = ctypes.windll.comctl32.DPA_SaveStream
DPA_SaveStream.restype = ctypes.c_int
DPA_SaveStream.argtypes = [
    ctypes.c_ssize_t,  # hdpa : HDPA
    ctypes.c_void_p,  # pfn : PFNDPASTREAM
    ctypes.c_void_p,  # pstream : IStream*
    ctypes.POINTER(None),  # pvInstData : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('COMCTL32.dll')
DPA_SaveStream = Fiddle::Function.new(
  lib['DPA_SaveStream'],
  [
    Fiddle::TYPE_INTPTR_T,  # hdpa : HDPA
    Fiddle::TYPE_VOIDP,  # pfn : PFNDPASTREAM
    Fiddle::TYPE_VOIDP,  # pstream : IStream*
    Fiddle::TYPE_VOIDP,  # pvInstData : void* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "comctl32")]
extern "system" {
    fn DPA_SaveStream(
        hdpa: isize,  // HDPA
        pfn: *const core::ffi::c_void,  // PFNDPASTREAM
        pstream: *mut core::ffi::c_void,  // IStream*
        pvInstData: *mut ()  // void* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("COMCTL32.dll")]
public static extern int DPA_SaveStream(IntPtr hdpa, IntPtr pfn, IntPtr pstream, IntPtr pvInstData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_DPA_SaveStream' -Namespace Win32 -PassThru
# $api::DPA_SaveStream(hdpa, pfn, pstream, pvInstData)
#uselib "COMCTL32.dll"
#func global DPA_SaveStream "DPA_SaveStream" sptr, sptr, sptr, sptr
; DPA_SaveStream hdpa, pfn, pstream, pvInstData   ; 戻り値は stat
; hdpa : HDPA -> "sptr"
; pfn : PFNDPASTREAM -> "sptr"
; pstream : IStream* -> "sptr"
; pvInstData : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "COMCTL32.dll"
#cfunc global DPA_SaveStream "DPA_SaveStream" sptr, sptr, sptr, sptr
; res = DPA_SaveStream(hdpa, pfn, pstream, pvInstData)
; hdpa : HDPA -> "sptr"
; pfn : PFNDPASTREAM -> "sptr"
; pstream : IStream* -> "sptr"
; pvInstData : void* optional -> "sptr"
; HRESULT DPA_SaveStream(HDPA hdpa, PFNDPASTREAM pfn, IStream* pstream, void* pvInstData)
#uselib "COMCTL32.dll"
#cfunc global DPA_SaveStream "DPA_SaveStream" intptr, intptr, intptr, intptr
; res = DPA_SaveStream(hdpa, pfn, pstream, pvInstData)
; hdpa : HDPA -> "intptr"
; pfn : PFNDPASTREAM -> "intptr"
; pstream : IStream* -> "intptr"
; pvInstData : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procDPA_SaveStream = comctl32.NewProc("DPA_SaveStream")
)

// hdpa (HDPA), pfn (PFNDPASTREAM), pstream (IStream*), pvInstData (void* optional)
r1, _, err := procDPA_SaveStream.Call(
	uintptr(hdpa),
	uintptr(pfn),
	uintptr(pstream),
	uintptr(pvInstData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DPA_SaveStream(
  hdpa: NativeInt;   // HDPA
  pfn: Pointer;   // PFNDPASTREAM
  pstream: Pointer;   // IStream*
  pvInstData: Pointer   // void* optional
): Integer; stdcall;
  external 'COMCTL32.dll' name 'DPA_SaveStream';
result := DllCall("COMCTL32\DPA_SaveStream"
    , "Ptr", hdpa   ; HDPA
    , "Ptr", pfn   ; PFNDPASTREAM
    , "Ptr", pstream   ; IStream*
    , "Ptr", pvInstData   ; void* optional
    , "Int")   ; return: HRESULT
●DPA_SaveStream(hdpa, pfn, pstream, pvInstData) = DLL("COMCTL32.dll", "int DPA_SaveStream(int, void*, void*, void*)")
# 呼び出し: DPA_SaveStream(hdpa, pfn, pstream, pvInstData)
# hdpa : HDPA -> "int"
# pfn : PFNDPASTREAM -> "void*"
# pstream : IStream* -> "void*"
# pvInstData : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。