Win32 API 日本語リファレンス
ホームSystem.Com.StructuredStorage › OleConvertOLESTREAMToIStorage

OleConvertOLESTREAMToIStorage

関数
OLE1のOLESTREAMをOLE2のIStorageへ変換する。
DLLole32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HRESULT OleConvertOLESTREAMToIStorage(
    OLESTREAM* lpolestream,
    IStorage* pstg,
    const DVTARGETDEVICE* ptd
);

パラメーター

名前方向
lpolestreamOLESTREAM*in
pstgIStorage*in
ptdDVTARGETDEVICE*in

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT OleConvertOLESTREAMToIStorage(
    OLESTREAM* lpolestream,
    IStorage* pstg,
    const DVTARGETDEVICE* ptd
);
[DllImport("ole32.dll", ExactSpelling = true)]
static extern int OleConvertOLESTREAMToIStorage(
    IntPtr lpolestream,   // OLESTREAM*
    IntPtr pstg,   // IStorage*
    IntPtr ptd   // DVTARGETDEVICE*
);
<DllImport("ole32.dll", ExactSpelling:=True)>
Public Shared Function OleConvertOLESTREAMToIStorage(
    lpolestream As IntPtr,   ' OLESTREAM*
    pstg As IntPtr,   ' IStorage*
    ptd As IntPtr   ' DVTARGETDEVICE*
) As Integer
End Function
' lpolestream : OLESTREAM*
' pstg : IStorage*
' ptd : DVTARGETDEVICE*
Declare PtrSafe Function OleConvertOLESTREAMToIStorage Lib "ole32" ( _
    ByVal lpolestream As LongPtr, _
    ByVal pstg As LongPtr, _
    ByVal ptd As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

OleConvertOLESTREAMToIStorage = ctypes.windll.ole32.OleConvertOLESTREAMToIStorage
OleConvertOLESTREAMToIStorage.restype = ctypes.c_int
OleConvertOLESTREAMToIStorage.argtypes = [
    ctypes.c_void_p,  # lpolestream : OLESTREAM*
    ctypes.c_void_p,  # pstg : IStorage*
    ctypes.c_void_p,  # ptd : DVTARGETDEVICE*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	ole32 = windows.NewLazySystemDLL("ole32.dll")
	procOleConvertOLESTREAMToIStorage = ole32.NewProc("OleConvertOLESTREAMToIStorage")
)

// lpolestream (OLESTREAM*), pstg (IStorage*), ptd (DVTARGETDEVICE*)
r1, _, err := procOleConvertOLESTREAMToIStorage.Call(
	uintptr(lpolestream),
	uintptr(pstg),
	uintptr(ptd),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function OleConvertOLESTREAMToIStorage(
  lpolestream: Pointer;   // OLESTREAM*
  pstg: Pointer;   // IStorage*
  ptd: Pointer   // DVTARGETDEVICE*
): Integer; stdcall;
  external 'ole32.dll' name 'OleConvertOLESTREAMToIStorage';
result := DllCall("ole32\OleConvertOLESTREAMToIStorage"
    , "Ptr", lpolestream   ; OLESTREAM*
    , "Ptr", pstg   ; IStorage*
    , "Ptr", ptd   ; DVTARGETDEVICE*
    , "Int")   ; return: HRESULT
●OleConvertOLESTREAMToIStorage(lpolestream, pstg, ptd) = DLL("ole32.dll", "int OleConvertOLESTREAMToIStorage(void*, void*, void*)")
# 呼び出し: OleConvertOLESTREAMToIStorage(lpolestream, pstg, ptd)
# lpolestream : OLESTREAM* -> "void*"
# pstg : IStorage* -> "void*"
# ptd : DVTARGETDEVICE* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。