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