Win32 API 日本語リファレンス
ホームSystem.Ole › VarDecAbs

VarDecAbs

関数
DECIMAL値の絶対値を計算し結果を返す。
DLLOLEAUT32.dll呼出規約winapi

シグネチャ

// OLEAUT32.dll
#include <windows.h>

HRESULT VarDecAbs(
    DECIMAL* pdecIn,
    DECIMAL* pdecResult
);

パラメーター

名前方向
pdecInDECIMAL*in
pdecResultDECIMAL*out

戻り値の型: HRESULT

各言語での呼び出し定義

// OLEAUT32.dll
#include <windows.h>

HRESULT VarDecAbs(
    DECIMAL* pdecIn,
    DECIMAL* pdecResult
);
[DllImport("OLEAUT32.dll", ExactSpelling = true)]
static extern int VarDecAbs(
    IntPtr pdecIn,   // DECIMAL*
    IntPtr pdecResult   // DECIMAL* out
);
<DllImport("OLEAUT32.dll", ExactSpelling:=True)>
Public Shared Function VarDecAbs(
    pdecIn As IntPtr,   ' DECIMAL*
    pdecResult As IntPtr   ' DECIMAL* out
) As Integer
End Function
' pdecIn : DECIMAL*
' pdecResult : DECIMAL* out
Declare PtrSafe Function VarDecAbs 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

VarDecAbs = ctypes.windll.oleaut32.VarDecAbs
VarDecAbs.restype = ctypes.c_int
VarDecAbs.argtypes = [
    ctypes.c_void_p,  # pdecIn : DECIMAL*
    ctypes.c_void_p,  # pdecResult : DECIMAL* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OLEAUT32.dll')
VarDecAbs = Fiddle::Function.new(
  lib['VarDecAbs'],
  [
    Fiddle::TYPE_VOIDP,  # pdecIn : DECIMAL*
    Fiddle::TYPE_VOIDP,  # pdecResult : DECIMAL* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "oleaut32")]
extern "system" {
    fn VarDecAbs(
        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 VarDecAbs(IntPtr pdecIn, IntPtr pdecResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEAUT32_VarDecAbs' -Namespace Win32 -PassThru
# $api::VarDecAbs(pdecIn, pdecResult)
#uselib "OLEAUT32.dll"
#func global VarDecAbs "VarDecAbs" sptr, sptr
; VarDecAbs varptr(pdecIn), varptr(pdecResult)   ; 戻り値は stat
; pdecIn : DECIMAL* -> "sptr"
; pdecResult : DECIMAL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "OLEAUT32.dll"
#cfunc global VarDecAbs "VarDecAbs" var, var
; res = VarDecAbs(pdecIn, pdecResult)
; pdecIn : DECIMAL* -> "var"
; pdecResult : DECIMAL* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT VarDecAbs(DECIMAL* pdecIn, DECIMAL* pdecResult)
#uselib "OLEAUT32.dll"
#cfunc global VarDecAbs "VarDecAbs" var, var
; res = VarDecAbs(pdecIn, pdecResult)
; pdecIn : DECIMAL* -> "var"
; pdecResult : DECIMAL* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	oleaut32 = windows.NewLazySystemDLL("OLEAUT32.dll")
	procVarDecAbs = oleaut32.NewProc("VarDecAbs")
)

// pdecIn (DECIMAL*), pdecResult (DECIMAL* out)
r1, _, err := procVarDecAbs.Call(
	uintptr(pdecIn),
	uintptr(pdecResult),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function VarDecAbs(
  pdecIn: Pointer;   // DECIMAL*
  pdecResult: Pointer   // DECIMAL* out
): Integer; stdcall;
  external 'OLEAUT32.dll' name 'VarDecAbs';
result := DllCall("OLEAUT32\VarDecAbs"
    , "Ptr", pdecIn   ; DECIMAL*
    , "Ptr", pdecResult   ; DECIMAL* out
    , "Int")   ; return: HRESULT
●VarDecAbs(pdecIn, pdecResult) = DLL("OLEAUT32.dll", "int VarDecAbs(void*, void*)")
# 呼び出し: VarDecAbs(pdecIn, pdecResult)
# pdecIn : DECIMAL* -> "void*"
# pdecResult : DECIMAL* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。