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