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

StgCreatePropSetStg

関数
ストレージ上にプロパティセットストレージを作成する。
DLLOLE32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HRESULT StgCreatePropSetStg(
    IStorage* pStorage,
    DWORD dwReserved,   // optional
    IPropertySetStorage** ppPropSetStg
);

パラメーター

名前方向
pStorageIStorage*in
dwReservedDWORDoptional
ppPropSetStgIPropertySetStorage**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

StgCreatePropSetStg = ctypes.windll.ole32.StgCreatePropSetStg
StgCreatePropSetStg.restype = ctypes.c_int
StgCreatePropSetStg.argtypes = [
    ctypes.c_void_p,  # pStorage : IStorage*
    wintypes.DWORD,  # dwReserved : DWORD optional
    ctypes.c_void_p,  # ppPropSetStg : IPropertySetStorage** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OLE32.dll')
StgCreatePropSetStg = Fiddle::Function.new(
  lib['StgCreatePropSetStg'],
  [
    Fiddle::TYPE_VOIDP,  # pStorage : IStorage*
    -Fiddle::TYPE_INT,  # dwReserved : DWORD optional
    Fiddle::TYPE_VOIDP,  # ppPropSetStg : IPropertySetStorage** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "ole32")]
extern "system" {
    fn StgCreatePropSetStg(
        pStorage: *mut core::ffi::c_void,  // IStorage*
        dwReserved: u32,  // DWORD optional
        ppPropSetStg: *mut *mut core::ffi::c_void  // IPropertySetStorage** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OLE32.dll")]
public static extern int StgCreatePropSetStg(IntPtr pStorage, uint dwReserved, IntPtr ppPropSetStg);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_StgCreatePropSetStg' -Namespace Win32 -PassThru
# $api::StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)
#uselib "OLE32.dll"
#func global StgCreatePropSetStg "StgCreatePropSetStg" sptr, sptr, sptr
; StgCreatePropSetStg pStorage, dwReserved, ppPropSetStg   ; 戻り値は stat
; pStorage : IStorage* -> "sptr"
; dwReserved : DWORD optional -> "sptr"
; ppPropSetStg : IPropertySetStorage** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "OLE32.dll"
#cfunc global StgCreatePropSetStg "StgCreatePropSetStg" sptr, int, sptr
; res = StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)
; pStorage : IStorage* -> "sptr"
; dwReserved : DWORD optional -> "int"
; ppPropSetStg : IPropertySetStorage** out -> "sptr"
; HRESULT StgCreatePropSetStg(IStorage* pStorage, DWORD dwReserved, IPropertySetStorage** ppPropSetStg)
#uselib "OLE32.dll"
#cfunc global StgCreatePropSetStg "StgCreatePropSetStg" intptr, int, intptr
; res = StgCreatePropSetStg(pStorage, dwReserved, ppPropSetStg)
; pStorage : IStorage* -> "intptr"
; dwReserved : DWORD optional -> "int"
; ppPropSetStg : IPropertySetStorage** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ole32 = windows.NewLazySystemDLL("OLE32.dll")
	procStgCreatePropSetStg = ole32.NewProc("StgCreatePropSetStg")
)

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