ホーム › System.Ole › VarDateFromR8
VarDateFromR8
関数倍精度浮動小数点数をDATE型の日付値に変換する。
シグネチャ
// OLEAUT32.dll
#include <windows.h>
HRESULT VarDateFromR8(
DOUBLE dblIn,
DOUBLE* pdateOut
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dblIn | DOUBLE | in |
| pdateOut | DOUBLE* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLEAUT32.dll
#include <windows.h>
HRESULT VarDateFromR8(
DOUBLE dblIn,
DOUBLE* pdateOut
);[DllImport("OLEAUT32.dll", ExactSpelling = true)]
static extern int VarDateFromR8(
double dblIn, // DOUBLE
out double pdateOut // DOUBLE* out
);<DllImport("OLEAUT32.dll", ExactSpelling:=True)>
Public Shared Function VarDateFromR8(
dblIn As Double, ' DOUBLE
<Out> ByRef pdateOut As Double ' DOUBLE* out
) As Integer
End Function' dblIn : DOUBLE
' pdateOut : DOUBLE* out
Declare PtrSafe Function VarDateFromR8 Lib "oleaut32" ( _
ByVal dblIn As Double, _
ByRef pdateOut As Double) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
VarDateFromR8 = ctypes.windll.oleaut32.VarDateFromR8
VarDateFromR8.restype = ctypes.c_int
VarDateFromR8.argtypes = [
ctypes.c_double, # dblIn : DOUBLE
ctypes.POINTER(ctypes.c_double), # pdateOut : DOUBLE* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLEAUT32.dll')
VarDateFromR8 = Fiddle::Function.new(
lib['VarDateFromR8'],
[
Fiddle::TYPE_DOUBLE, # dblIn : DOUBLE
Fiddle::TYPE_VOIDP, # pdateOut : DOUBLE* out
],
Fiddle::TYPE_INT)#[link(name = "oleaut32")]
extern "system" {
fn VarDateFromR8(
dblIn: f64, // DOUBLE
pdateOut: *mut f64 // DOUBLE* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLEAUT32.dll")]
public static extern int VarDateFromR8(double dblIn, out double pdateOut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEAUT32_VarDateFromR8' -Namespace Win32 -PassThru
# $api::VarDateFromR8(dblIn, pdateOut)#uselib "OLEAUT32.dll"
#func global VarDateFromR8 "VarDateFromR8" double, sptr
; VarDateFromR8 dblIn, varptr(pdateOut) ; 戻り値は stat
; dblIn : DOUBLE -> "double"
; pdateOut : DOUBLE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "OLEAUT32.dll" #cfunc global VarDateFromR8 "VarDateFromR8" double, var ; res = VarDateFromR8(dblIn, pdateOut) ; dblIn : DOUBLE -> "double" ; pdateOut : DOUBLE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OLEAUT32.dll" #cfunc global VarDateFromR8 "VarDateFromR8" double, sptr ; res = VarDateFromR8(dblIn, varptr(pdateOut)) ; dblIn : DOUBLE -> "double" ; pdateOut : DOUBLE* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT VarDateFromR8(DOUBLE dblIn, DOUBLE* pdateOut) #uselib "OLEAUT32.dll" #cfunc global VarDateFromR8 "VarDateFromR8" double, var ; res = VarDateFromR8(dblIn, pdateOut) ; dblIn : DOUBLE -> "double" ; pdateOut : DOUBLE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT VarDateFromR8(DOUBLE dblIn, DOUBLE* pdateOut) #uselib "OLEAUT32.dll" #cfunc global VarDateFromR8 "VarDateFromR8" double, intptr ; res = VarDateFromR8(dblIn, varptr(pdateOut)) ; dblIn : DOUBLE -> "double" ; pdateOut : DOUBLE* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
oleaut32 = windows.NewLazySystemDLL("OLEAUT32.dll")
procVarDateFromR8 = oleaut32.NewProc("VarDateFromR8")
)
// dblIn (DOUBLE), pdateOut (DOUBLE* out)
r1, _, err := procVarDateFromR8.Call(
uintptr(math.Float64bits(dblIn)),
uintptr(pdateOut),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULT
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。function VarDateFromR8(
dblIn: Double; // DOUBLE
pdateOut: Pointer // DOUBLE* out
): Integer; stdcall;
external 'OLEAUT32.dll' name 'VarDateFromR8';result := DllCall("OLEAUT32\VarDateFromR8"
, "Double", dblIn ; DOUBLE
, "Ptr", pdateOut ; DOUBLE* out
, "Int") ; return: HRESULT●VarDateFromR8(dblIn, pdateOut) = DLL("OLEAUT32.dll", "int VarDateFromR8(double, void*)")
# 呼び出し: VarDateFromR8(dblIn, pdateOut)
# dblIn : DOUBLE -> "double"
# pdateOut : DOUBLE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。