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

OleConvertIStorageToOLESTREAM

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

シグネチャ

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

HRESULT OleConvertIStorageToOLESTREAM(
    IStorage* pstg,
    OLESTREAM* lpolestream
);

パラメーター

名前方向
pstgIStorage*in
lpolestreamOLESTREAM*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

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

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

var (
	ole32 = windows.NewLazySystemDLL("ole32.dll")
	procOleConvertIStorageToOLESTREAM = ole32.NewProc("OleConvertIStorageToOLESTREAM")
)

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