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