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