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