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

VarUI8FromDisp

関数
IDispatchオブジェクトを符号なし8バイト整数に変換する。
DLLOLEAUT32.dll呼出規約winapi

シグネチャ

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

HRESULT VarUI8FromDisp(
    IDispatch* pdispIn,
    DWORD lcid,
    ULONGLONG* pi64Out
);

パラメーター

名前方向
pdispInIDispatch*in
lcidDWORDin
pi64OutULONGLONG*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT VarUI8FromDisp(
    IDispatch* pdispIn,
    DWORD lcid,
    ULONGLONG* pi64Out
);
[DllImport("OLEAUT32.dll", ExactSpelling = true)]
static extern int VarUI8FromDisp(
    IntPtr pdispIn,   // IDispatch*
    uint lcid,   // DWORD
    out ulong pi64Out   // ULONGLONG* out
);
<DllImport("OLEAUT32.dll", ExactSpelling:=True)>
Public Shared Function VarUI8FromDisp(
    pdispIn As IntPtr,   ' IDispatch*
    lcid As UInteger,   ' DWORD
    <Out> ByRef pi64Out As ULong   ' ULONGLONG* out
) As Integer
End Function
' pdispIn : IDispatch*
' lcid : DWORD
' pi64Out : ULONGLONG* out
Declare PtrSafe Function VarUI8FromDisp Lib "oleaut32" ( _
    ByVal pdispIn As LongPtr, _
    ByVal lcid As Long, _
    ByRef pi64Out As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

VarUI8FromDisp = ctypes.windll.oleaut32.VarUI8FromDisp
VarUI8FromDisp.restype = ctypes.c_int
VarUI8FromDisp.argtypes = [
    ctypes.c_void_p,  # pdispIn : IDispatch*
    wintypes.DWORD,  # lcid : DWORD
    ctypes.POINTER(ctypes.c_ulonglong),  # pi64Out : ULONGLONG* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OLEAUT32.dll')
VarUI8FromDisp = Fiddle::Function.new(
  lib['VarUI8FromDisp'],
  [
    Fiddle::TYPE_VOIDP,  # pdispIn : IDispatch*
    -Fiddle::TYPE_INT,  # lcid : DWORD
    Fiddle::TYPE_VOIDP,  # pi64Out : ULONGLONG* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "oleaut32")]
extern "system" {
    fn VarUI8FromDisp(
        pdispIn: *mut core::ffi::c_void,  // IDispatch*
        lcid: u32,  // DWORD
        pi64Out: *mut u64  // ULONGLONG* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OLEAUT32.dll")]
public static extern int VarUI8FromDisp(IntPtr pdispIn, uint lcid, out ulong pi64Out);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEAUT32_VarUI8FromDisp' -Namespace Win32 -PassThru
# $api::VarUI8FromDisp(pdispIn, lcid, pi64Out)
#uselib "OLEAUT32.dll"
#func global VarUI8FromDisp "VarUI8FromDisp" sptr, sptr, sptr
; VarUI8FromDisp pdispIn, lcid, varptr(pi64Out)   ; 戻り値は stat
; pdispIn : IDispatch* -> "sptr"
; lcid : DWORD -> "sptr"
; pi64Out : ULONGLONG* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "OLEAUT32.dll"
#cfunc global VarUI8FromDisp "VarUI8FromDisp" sptr, int, var
; res = VarUI8FromDisp(pdispIn, lcid, pi64Out)
; pdispIn : IDispatch* -> "sptr"
; lcid : DWORD -> "int"
; pi64Out : ULONGLONG* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT VarUI8FromDisp(IDispatch* pdispIn, DWORD lcid, ULONGLONG* pi64Out)
#uselib "OLEAUT32.dll"
#cfunc global VarUI8FromDisp "VarUI8FromDisp" intptr, int, var
; res = VarUI8FromDisp(pdispIn, lcid, pi64Out)
; pdispIn : IDispatch* -> "intptr"
; lcid : DWORD -> "int"
; pi64Out : ULONGLONG* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	oleaut32 = windows.NewLazySystemDLL("OLEAUT32.dll")
	procVarUI8FromDisp = oleaut32.NewProc("VarUI8FromDisp")
)

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