ホーム › System.Com.StructuredStorage › StgCreatePropStg
StgCreatePropStg
関数指定書式IDのプロパティストレージを新規作成する。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT StgCreatePropStg(
IUnknown* pUnk,
const GUID* fmtid,
const GUID* pclsid,
DWORD grfFlags,
DWORD dwReserved, // optional
IPropertyStorage** ppPropStg
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pUnk | IUnknown* | in |
| fmtid | GUID* | in |
| pclsid | GUID* | in |
| grfFlags | DWORD | in |
| dwReserved | DWORD | optional |
| ppPropStg | IPropertyStorage** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
HRESULT StgCreatePropStg(
IUnknown* pUnk,
const GUID* fmtid,
const GUID* pclsid,
DWORD grfFlags,
DWORD dwReserved, // optional
IPropertyStorage** ppPropStg
);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int StgCreatePropStg(
IntPtr pUnk, // IUnknown*
ref Guid fmtid, // GUID*
ref Guid pclsid, // GUID*
uint grfFlags, // DWORD
uint dwReserved, // DWORD optional
IntPtr ppPropStg // IPropertyStorage** out
);<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function StgCreatePropStg(
pUnk As IntPtr, ' IUnknown*
ByRef fmtid As Guid, ' GUID*
ByRef pclsid As Guid, ' GUID*
grfFlags As UInteger, ' DWORD
dwReserved As UInteger, ' DWORD optional
ppPropStg As IntPtr ' IPropertyStorage** out
) As Integer
End Function' pUnk : IUnknown*
' fmtid : GUID*
' pclsid : GUID*
' grfFlags : DWORD
' dwReserved : DWORD optional
' ppPropStg : IPropertyStorage** out
Declare PtrSafe Function StgCreatePropStg Lib "ole32" ( _
ByVal pUnk As LongPtr, _
ByVal fmtid As LongPtr, _
ByVal pclsid As LongPtr, _
ByVal grfFlags As Long, _
ByVal dwReserved As Long, _
ByVal ppPropStg As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
StgCreatePropStg = ctypes.windll.ole32.StgCreatePropStg
StgCreatePropStg.restype = ctypes.c_int
StgCreatePropStg.argtypes = [
ctypes.c_void_p, # pUnk : IUnknown*
ctypes.c_void_p, # fmtid : GUID*
ctypes.c_void_p, # pclsid : GUID*
wintypes.DWORD, # grfFlags : DWORD
wintypes.DWORD, # dwReserved : DWORD optional
ctypes.c_void_p, # ppPropStg : IPropertyStorage** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
StgCreatePropStg = Fiddle::Function.new(
lib['StgCreatePropStg'],
[
Fiddle::TYPE_VOIDP, # pUnk : IUnknown*
Fiddle::TYPE_VOIDP, # fmtid : GUID*
Fiddle::TYPE_VOIDP, # pclsid : GUID*
-Fiddle::TYPE_INT, # grfFlags : DWORD
-Fiddle::TYPE_INT, # dwReserved : DWORD optional
Fiddle::TYPE_VOIDP, # ppPropStg : IPropertyStorage** out
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn StgCreatePropStg(
pUnk: *mut core::ffi::c_void, // IUnknown*
fmtid: *const GUID, // GUID*
pclsid: *const GUID, // GUID*
grfFlags: u32, // DWORD
dwReserved: u32, // DWORD optional
ppPropStg: *mut *mut core::ffi::c_void // IPropertyStorage** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern int StgCreatePropStg(IntPtr pUnk, ref Guid fmtid, ref Guid pclsid, uint grfFlags, uint dwReserved, IntPtr ppPropStg);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_StgCreatePropStg' -Namespace Win32 -PassThru
# $api::StgCreatePropStg(pUnk, fmtid, pclsid, grfFlags, dwReserved, ppPropStg)#uselib "OLE32.dll"
#func global StgCreatePropStg "StgCreatePropStg" sptr, sptr, sptr, sptr, sptr, sptr
; StgCreatePropStg pUnk, varptr(fmtid), varptr(pclsid), grfFlags, dwReserved, ppPropStg ; 戻り値は stat
; pUnk : IUnknown* -> "sptr"
; fmtid : GUID* -> "sptr"
; pclsid : GUID* -> "sptr"
; grfFlags : DWORD -> "sptr"
; dwReserved : DWORD optional -> "sptr"
; ppPropStg : IPropertyStorage** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "OLE32.dll" #cfunc global StgCreatePropStg "StgCreatePropStg" sptr, var, var, int, int, sptr ; res = StgCreatePropStg(pUnk, fmtid, pclsid, grfFlags, dwReserved, ppPropStg) ; pUnk : IUnknown* -> "sptr" ; fmtid : GUID* -> "var" ; pclsid : GUID* -> "var" ; grfFlags : DWORD -> "int" ; dwReserved : DWORD optional -> "int" ; ppPropStg : IPropertyStorage** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OLE32.dll" #cfunc global StgCreatePropStg "StgCreatePropStg" sptr, sptr, sptr, int, int, sptr ; res = StgCreatePropStg(pUnk, varptr(fmtid), varptr(pclsid), grfFlags, dwReserved, ppPropStg) ; pUnk : IUnknown* -> "sptr" ; fmtid : GUID* -> "sptr" ; pclsid : GUID* -> "sptr" ; grfFlags : DWORD -> "int" ; dwReserved : DWORD optional -> "int" ; ppPropStg : IPropertyStorage** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT StgCreatePropStg(IUnknown* pUnk, GUID* fmtid, GUID* pclsid, DWORD grfFlags, DWORD dwReserved, IPropertyStorage** ppPropStg) #uselib "OLE32.dll" #cfunc global StgCreatePropStg "StgCreatePropStg" intptr, var, var, int, int, intptr ; res = StgCreatePropStg(pUnk, fmtid, pclsid, grfFlags, dwReserved, ppPropStg) ; pUnk : IUnknown* -> "intptr" ; fmtid : GUID* -> "var" ; pclsid : GUID* -> "var" ; grfFlags : DWORD -> "int" ; dwReserved : DWORD optional -> "int" ; ppPropStg : IPropertyStorage** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT StgCreatePropStg(IUnknown* pUnk, GUID* fmtid, GUID* pclsid, DWORD grfFlags, DWORD dwReserved, IPropertyStorage** ppPropStg) #uselib "OLE32.dll" #cfunc global StgCreatePropStg "StgCreatePropStg" intptr, intptr, intptr, int, int, intptr ; res = StgCreatePropStg(pUnk, varptr(fmtid), varptr(pclsid), grfFlags, dwReserved, ppPropStg) ; pUnk : IUnknown* -> "intptr" ; fmtid : GUID* -> "intptr" ; pclsid : GUID* -> "intptr" ; grfFlags : DWORD -> "int" ; dwReserved : DWORD optional -> "int" ; ppPropStg : IPropertyStorage** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procStgCreatePropStg = ole32.NewProc("StgCreatePropStg")
)
// pUnk (IUnknown*), fmtid (GUID*), pclsid (GUID*), grfFlags (DWORD), dwReserved (DWORD optional), ppPropStg (IPropertyStorage** out)
r1, _, err := procStgCreatePropStg.Call(
uintptr(pUnk),
uintptr(fmtid),
uintptr(pclsid),
uintptr(grfFlags),
uintptr(dwReserved),
uintptr(ppPropStg),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction StgCreatePropStg(
pUnk: Pointer; // IUnknown*
fmtid: PGUID; // GUID*
pclsid: PGUID; // GUID*
grfFlags: DWORD; // DWORD
dwReserved: DWORD; // DWORD optional
ppPropStg: Pointer // IPropertyStorage** out
): Integer; stdcall;
external 'OLE32.dll' name 'StgCreatePropStg';result := DllCall("OLE32\StgCreatePropStg"
, "Ptr", pUnk ; IUnknown*
, "Ptr", fmtid ; GUID*
, "Ptr", pclsid ; GUID*
, "UInt", grfFlags ; DWORD
, "UInt", dwReserved ; DWORD optional
, "Ptr", ppPropStg ; IPropertyStorage** out
, "Int") ; return: HRESULT●StgCreatePropStg(pUnk, fmtid, pclsid, grfFlags, dwReserved, ppPropStg) = DLL("OLE32.dll", "int StgCreatePropStg(void*, void*, void*, dword, dword, void*)")
# 呼び出し: StgCreatePropStg(pUnk, fmtid, pclsid, grfFlags, dwReserved, ppPropStg)
# pUnk : IUnknown* -> "void*"
# fmtid : GUID* -> "void*"
# pclsid : GUID* -> "void*"
# grfFlags : DWORD -> "dword"
# dwReserved : DWORD optional -> "dword"
# ppPropStg : IPropertyStorage** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。