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

DPA_LoadStream

関数
ストリームから動的ポインタ配列を読み込む。
DLLCOMCTL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT DPA_LoadStream(
    HDPA* phdpa,
    PFNDPASTREAM pfn,
    IStream* pstream,
    void* pvInstData   // optional
);

パラメーター

名前方向
phdpaHDPA*out
pfnPFNDPASTREAMin
pstreamIStream*in
pvInstDatavoid*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DPA_LoadStream(
    HDPA* phdpa,
    PFNDPASTREAM pfn,
    IStream* pstream,
    void* pvInstData   // optional
);
[DllImport("COMCTL32.dll", ExactSpelling = true)]
static extern int DPA_LoadStream(
    out IntPtr phdpa,   // HDPA* out
    IntPtr pfn,   // PFNDPASTREAM
    IntPtr pstream,   // IStream*
    IntPtr pvInstData   // void* optional
);
<DllImport("COMCTL32.dll", ExactSpelling:=True)>
Public Shared Function DPA_LoadStream(
    <Out> ByRef phdpa As IntPtr,   ' HDPA* out
    pfn As IntPtr,   ' PFNDPASTREAM
    pstream As IntPtr,   ' IStream*
    pvInstData As IntPtr   ' void* optional
) As Integer
End Function
' phdpa : HDPA* out
' pfn : PFNDPASTREAM
' pstream : IStream*
' pvInstData : void* optional
Declare PtrSafe Function DPA_LoadStream Lib "comctl32" ( _
    ByRef phdpa 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_LoadStream = ctypes.windll.comctl32.DPA_LoadStream
DPA_LoadStream.restype = ctypes.c_int
DPA_LoadStream.argtypes = [
    ctypes.c_void_p,  # phdpa : HDPA* out
    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_LoadStream = Fiddle::Function.new(
  lib['DPA_LoadStream'],
  [
    Fiddle::TYPE_VOIDP,  # phdpa : HDPA* out
    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_LoadStream(
        phdpa: *mut isize,  // HDPA* out
        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_LoadStream(out IntPtr phdpa, IntPtr pfn, IntPtr pstream, IntPtr pvInstData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_DPA_LoadStream' -Namespace Win32 -PassThru
# $api::DPA_LoadStream(phdpa, pfn, pstream, pvInstData)
#uselib "COMCTL32.dll"
#func global DPA_LoadStream "DPA_LoadStream" sptr, sptr, sptr, sptr
; DPA_LoadStream phdpa, pfn, pstream, pvInstData   ; 戻り値は stat
; phdpa : HDPA* out -> "sptr"
; pfn : PFNDPASTREAM -> "sptr"
; pstream : IStream* -> "sptr"
; pvInstData : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "COMCTL32.dll"
#cfunc global DPA_LoadStream "DPA_LoadStream" int, sptr, sptr, sptr
; res = DPA_LoadStream(phdpa, pfn, pstream, pvInstData)
; phdpa : HDPA* out -> "int"
; pfn : PFNDPASTREAM -> "sptr"
; pstream : IStream* -> "sptr"
; pvInstData : void* optional -> "sptr"
; HRESULT DPA_LoadStream(HDPA* phdpa, PFNDPASTREAM pfn, IStream* pstream, void* pvInstData)
#uselib "COMCTL32.dll"
#cfunc global DPA_LoadStream "DPA_LoadStream" int, intptr, intptr, intptr
; res = DPA_LoadStream(phdpa, pfn, pstream, pvInstData)
; phdpa : HDPA* out -> "int"
; pfn : PFNDPASTREAM -> "intptr"
; pstream : IStream* -> "intptr"
; pvInstData : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procDPA_LoadStream = comctl32.NewProc("DPA_LoadStream")
)

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