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