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