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