ホーム › System.Com.StructuredStorage › PropVariantToDoubleVectorAlloc
PropVariantToDoubleVectorAlloc
関数PROPVARIANTから倍精度浮動小数点数の配列を取り出し、新しく確保したバッファに格納する。
シグネチャ
// PROPSYS.dll
#include <windows.h>
HRESULT PropVariantToDoubleVectorAlloc(
const PROPVARIANT* propvar,
DOUBLE** pprgn,
DWORD* pcElem
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| propvar | PROPVARIANT* | in |
| pprgn | DOUBLE** | out |
| pcElem | DWORD* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// PROPSYS.dll
#include <windows.h>
HRESULT PropVariantToDoubleVectorAlloc(
const PROPVARIANT* propvar,
DOUBLE** pprgn,
DWORD* pcElem
);[DllImport("PROPSYS.dll", ExactSpelling = true)]
static extern int PropVariantToDoubleVectorAlloc(
IntPtr propvar, // PROPVARIANT*
IntPtr pprgn, // DOUBLE** out
out uint pcElem // DWORD* out
);<DllImport("PROPSYS.dll", ExactSpelling:=True)>
Public Shared Function PropVariantToDoubleVectorAlloc(
propvar As IntPtr, ' PROPVARIANT*
pprgn As IntPtr, ' DOUBLE** out
<Out> ByRef pcElem As UInteger ' DWORD* out
) As Integer
End Function' propvar : PROPVARIANT*
' pprgn : DOUBLE** out
' pcElem : DWORD* out
Declare PtrSafe Function PropVariantToDoubleVectorAlloc Lib "propsys" ( _
ByVal propvar As LongPtr, _
ByVal pprgn As LongPtr, _
ByRef pcElem As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PropVariantToDoubleVectorAlloc = ctypes.windll.propsys.PropVariantToDoubleVectorAlloc
PropVariantToDoubleVectorAlloc.restype = ctypes.c_int
PropVariantToDoubleVectorAlloc.argtypes = [
ctypes.c_void_p, # propvar : PROPVARIANT*
ctypes.c_void_p, # pprgn : DOUBLE** out
ctypes.POINTER(wintypes.DWORD), # pcElem : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('PROPSYS.dll')
PropVariantToDoubleVectorAlloc = Fiddle::Function.new(
lib['PropVariantToDoubleVectorAlloc'],
[
Fiddle::TYPE_VOIDP, # propvar : PROPVARIANT*
Fiddle::TYPE_VOIDP, # pprgn : DOUBLE** out
Fiddle::TYPE_VOIDP, # pcElem : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "propsys")]
extern "system" {
fn PropVariantToDoubleVectorAlloc(
propvar: *const PROPVARIANT, // PROPVARIANT*
pprgn: *mut *mut f64, // DOUBLE** out
pcElem: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("PROPSYS.dll")]
public static extern int PropVariantToDoubleVectorAlloc(IntPtr propvar, IntPtr pprgn, out uint pcElem);
"@
$api = Add-Type -MemberDefinition $sig -Name 'PROPSYS_PropVariantToDoubleVectorAlloc' -Namespace Win32 -PassThru
# $api::PropVariantToDoubleVectorAlloc(propvar, pprgn, pcElem)#uselib "PROPSYS.dll"
#func global PropVariantToDoubleVectorAlloc "PropVariantToDoubleVectorAlloc" sptr, sptr, sptr
; PropVariantToDoubleVectorAlloc varptr(propvar), varptr(pprgn), varptr(pcElem) ; 戻り値は stat
; propvar : PROPVARIANT* -> "sptr"
; pprgn : DOUBLE** out -> "sptr"
; pcElem : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "PROPSYS.dll" #cfunc global PropVariantToDoubleVectorAlloc "PropVariantToDoubleVectorAlloc" var, var, var ; res = PropVariantToDoubleVectorAlloc(propvar, pprgn, pcElem) ; propvar : PROPVARIANT* -> "var" ; pprgn : DOUBLE** out -> "var" ; pcElem : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "PROPSYS.dll" #cfunc global PropVariantToDoubleVectorAlloc "PropVariantToDoubleVectorAlloc" sptr, sptr, sptr ; res = PropVariantToDoubleVectorAlloc(varptr(propvar), varptr(pprgn), varptr(pcElem)) ; propvar : PROPVARIANT* -> "sptr" ; pprgn : DOUBLE** out -> "sptr" ; pcElem : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT PropVariantToDoubleVectorAlloc(PROPVARIANT* propvar, DOUBLE** pprgn, DWORD* pcElem) #uselib "PROPSYS.dll" #cfunc global PropVariantToDoubleVectorAlloc "PropVariantToDoubleVectorAlloc" var, var, var ; res = PropVariantToDoubleVectorAlloc(propvar, pprgn, pcElem) ; propvar : PROPVARIANT* -> "var" ; pprgn : DOUBLE** out -> "var" ; pcElem : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT PropVariantToDoubleVectorAlloc(PROPVARIANT* propvar, DOUBLE** pprgn, DWORD* pcElem) #uselib "PROPSYS.dll" #cfunc global PropVariantToDoubleVectorAlloc "PropVariantToDoubleVectorAlloc" intptr, intptr, intptr ; res = PropVariantToDoubleVectorAlloc(varptr(propvar), varptr(pprgn), varptr(pcElem)) ; propvar : PROPVARIANT* -> "intptr" ; pprgn : DOUBLE** out -> "intptr" ; pcElem : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
propsys = windows.NewLazySystemDLL("PROPSYS.dll")
procPropVariantToDoubleVectorAlloc = propsys.NewProc("PropVariantToDoubleVectorAlloc")
)
// propvar (PROPVARIANT*), pprgn (DOUBLE** out), pcElem (DWORD* out)
r1, _, err := procPropVariantToDoubleVectorAlloc.Call(
uintptr(propvar),
uintptr(pprgn),
uintptr(pcElem),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction PropVariantToDoubleVectorAlloc(
propvar: Pointer; // PROPVARIANT*
pprgn: Pointer; // DOUBLE** out
pcElem: Pointer // DWORD* out
): Integer; stdcall;
external 'PROPSYS.dll' name 'PropVariantToDoubleVectorAlloc';result := DllCall("PROPSYS\PropVariantToDoubleVectorAlloc"
, "Ptr", propvar ; PROPVARIANT*
, "Ptr", pprgn ; DOUBLE** out
, "Ptr", pcElem ; DWORD* out
, "Int") ; return: HRESULT●PropVariantToDoubleVectorAlloc(propvar, pprgn, pcElem) = DLL("PROPSYS.dll", "int PropVariantToDoubleVectorAlloc(void*, void*, void*)")
# 呼び出し: PropVariantToDoubleVectorAlloc(propvar, pprgn, pcElem)
# propvar : PROPVARIANT* -> "void*"
# pprgn : DOUBLE** out -> "void*"
# pcElem : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。