ホーム › System.Ole › OleSave
OleSave
関数OLEオブジェクトを指定ストレージに保存する。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT OleSave(
IPersistStorage* pPS,
IStorage* pStg,
BOOL fSameAsLoad
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pPS | IPersistStorage* | in |
| pStg | IStorage* | in |
| fSameAsLoad | BOOL | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
HRESULT OleSave(
IPersistStorage* pPS,
IStorage* pStg,
BOOL fSameAsLoad
);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int OleSave(
IntPtr pPS, // IPersistStorage*
IntPtr pStg, // IStorage*
bool fSameAsLoad // BOOL
);<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function OleSave(
pPS As IntPtr, ' IPersistStorage*
pStg As IntPtr, ' IStorage*
fSameAsLoad As Boolean ' BOOL
) As Integer
End Function' pPS : IPersistStorage*
' pStg : IStorage*
' fSameAsLoad : BOOL
Declare PtrSafe Function OleSave Lib "ole32" ( _
ByVal pPS As LongPtr, _
ByVal pStg As LongPtr, _
ByVal fSameAsLoad As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
OleSave = ctypes.windll.ole32.OleSave
OleSave.restype = ctypes.c_int
OleSave.argtypes = [
ctypes.c_void_p, # pPS : IPersistStorage*
ctypes.c_void_p, # pStg : IStorage*
wintypes.BOOL, # fSameAsLoad : BOOL
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
OleSave = Fiddle::Function.new(
lib['OleSave'],
[
Fiddle::TYPE_VOIDP, # pPS : IPersistStorage*
Fiddle::TYPE_VOIDP, # pStg : IStorage*
Fiddle::TYPE_INT, # fSameAsLoad : BOOL
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn OleSave(
pPS: *mut core::ffi::c_void, // IPersistStorage*
pStg: *mut core::ffi::c_void, // IStorage*
fSameAsLoad: i32 // BOOL
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern int OleSave(IntPtr pPS, IntPtr pStg, bool fSameAsLoad);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_OleSave' -Namespace Win32 -PassThru
# $api::OleSave(pPS, pStg, fSameAsLoad)#uselib "OLE32.dll"
#func global OleSave "OleSave" sptr, sptr, sptr
; OleSave pPS, pStg, fSameAsLoad ; 戻り値は stat
; pPS : IPersistStorage* -> "sptr"
; pStg : IStorage* -> "sptr"
; fSameAsLoad : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "OLE32.dll"
#cfunc global OleSave "OleSave" sptr, sptr, int
; res = OleSave(pPS, pStg, fSameAsLoad)
; pPS : IPersistStorage* -> "sptr"
; pStg : IStorage* -> "sptr"
; fSameAsLoad : BOOL -> "int"; HRESULT OleSave(IPersistStorage* pPS, IStorage* pStg, BOOL fSameAsLoad)
#uselib "OLE32.dll"
#cfunc global OleSave "OleSave" intptr, intptr, int
; res = OleSave(pPS, pStg, fSameAsLoad)
; pPS : IPersistStorage* -> "intptr"
; pStg : IStorage* -> "intptr"
; fSameAsLoad : BOOL -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procOleSave = ole32.NewProc("OleSave")
)
// pPS (IPersistStorage*), pStg (IStorage*), fSameAsLoad (BOOL)
r1, _, err := procOleSave.Call(
uintptr(pPS),
uintptr(pStg),
uintptr(fSameAsLoad),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction OleSave(
pPS: Pointer; // IPersistStorage*
pStg: Pointer; // IStorage*
fSameAsLoad: BOOL // BOOL
): Integer; stdcall;
external 'OLE32.dll' name 'OleSave';result := DllCall("OLE32\OleSave"
, "Ptr", pPS ; IPersistStorage*
, "Ptr", pStg ; IStorage*
, "Int", fSameAsLoad ; BOOL
, "Int") ; return: HRESULT●OleSave(pPS, pStg, fSameAsLoad) = DLL("OLE32.dll", "int OleSave(void*, void*, bool)")
# 呼び出し: OleSave(pPS, pStg, fSameAsLoad)
# pPS : IPersistStorage* -> "void*"
# pStg : IStorage* -> "void*"
# fSameAsLoad : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。