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