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