ホーム › System.Ole › VarCyMul
VarCyMul
関数2つの通貨型(CY)値を乗算し結果を返す。
シグネチャ
// OLEAUT32.dll
#include <windows.h>
HRESULT VarCyMul(
CY cyLeft,
CY cyRight,
CY* pcyResult
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| cyLeft | CY | in | 1 番目の variant。 |
| cyRight | CY | in | 2 番目の variant。 |
| pcyResult | CY* | out | 結果の variant。 |
戻り値の型: HRESULT
公式ドキュメント
currency 型の 2 つの variant を乗算します。
戻り値
この関数が成功した場合は S_OK を返します。それ以外の場合は HRESULT エラーコードを返します。
解説(Remarks)
cyLeft または cyRight のいずれかのフィールドが初期化されていない場合、既定で大きな値となり、DISP_E_OVERFLOW を引き起こすことがあります。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// 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)。const std = @import("std");
extern "oleaut32" fn VarCyMul(
cyLeft: CY, // CY
cyRight: CY, // CY
pcyResult: [*c]CY // CY* out
) callconv(std.os.windows.WINAPI) i32;proc VarCyMul(
cyLeft: CY, # CY
cyRight: CY, # CY
pcyResult: ptr CY # CY* out
): int32 {.importc: "VarCyMul", stdcall, dynlib: "OLEAUT32.dll".}pragma(lib, "oleaut32");
extern(Windows)
int VarCyMul(
CY cyLeft, // CY
CY cyRight, // CY
CY* pcyResult // CY* out
);ccall((:VarCyMul, "OLEAUT32.dll"), stdcall, Int32,
(CY, CY, Ptr{CY}),
cyLeft, cyRight, pcyResult)
# cyLeft : CY -> CY
# cyRight : CY -> CY
# pcyResult : CY* out -> Ptr{CY}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t VarCyMul(
CY cyLeft,
CY cyRight,
void* pcyResult);
]]
local oleaut32 = ffi.load("oleaut32")
-- oleaut32.VarCyMul(cyLeft, cyRight, pcyResult)
-- cyLeft : CY
-- cyRight : CY
-- pcyResult : CY* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OLEAUT32.dll');
const VarCyMul = lib.func('__stdcall', 'VarCyMul', 'int32_t', ['CY', 'CY', 'void *']);
// VarCyMul(cyLeft, cyRight, pcyResult)
// cyLeft : CY -> 'CY'
// cyRight : CY -> 'CY'
// pcyResult : CY* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OLEAUT32.dll", {
VarCyMul: { parameters: ["buffer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.VarCyMul(cyLeft, cyRight, pcyResult)
// cyLeft : CY -> "buffer"
// cyRight : CY -> "buffer"
// pcyResult : CY* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t VarCyMul(
CY cyLeft,
CY cyRight,
void* pcyResult);
C, "OLEAUT32.dll");
// $ffi->VarCyMul(cyLeft, cyRight, pcyResult);
// cyLeft : CY
// cyRight : CY
// pcyResult : CY* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Oleaut32 extends StdCallLibrary {
Oleaut32 INSTANCE = Native.load("oleaut32", Oleaut32.class);
int VarCyMul(
CY /* extends Structure (by value) */ cyLeft, // CY
CY /* extends Structure (by value) */ cyRight, // CY
Pointer pcyResult // CY* out
);
}@[Link("oleaut32")]
lib LibOLEAUT32
fun VarCyMul = VarCyMul(
cyLeft : CY, # CY
cyRight : CY, # CY
pcyResult : CY* # CY* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef VarCyMulNative = Int32 Function(CY, CY, Pointer<Void>);
typedef VarCyMulDart = int Function(int, int, Pointer<Void>);
final VarCyMul = DynamicLibrary.open('OLEAUT32.dll')
.lookupFunction<VarCyMulNative, VarCyMulDart>('VarCyMul');
// cyLeft : CY -> CY
// cyRight : CY -> CY
// pcyResult : CY* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function VarCyMul(
cyLeft: CY; // CY
cyRight: CY; // CY
pcyResult: Pointer // CY* out
): Integer; stdcall;
external 'OLEAUT32.dll' name 'VarCyMul';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "VarCyMul"
c_VarCyMul :: CY -> CY -> Ptr () -> IO Int32
-- cyLeft : CY -> CY
-- cyRight : CY -> CY
-- pcyResult : CY* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※値渡し構造体は GHC FFI で直接渡せません。Ptr で渡すラッパ(C側)経由にしてください。open Ctypes
open Foreign
let varcymul =
foreign "VarCyMul"
(CY @-> CY @-> (ptr void) @-> returning int32_t)
(* cyLeft : CY -> CY *)
(* cyRight : CY -> CY *)
(* pcyResult : CY* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library oleaut32 (t "OLEAUT32.dll"))
(cffi:use-foreign-library oleaut32)
(cffi:defcfun ("VarCyMul" var-cy-mul :convention :stdcall) :int32
(cy-left (:struct cy)) ; CY
(cy-right (:struct cy)) ; CY
(pcy-result :pointer)) ; CY* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $VarCyMul = Win32::API::More->new('OLEAUT32',
'int VarCyMul(LPVOID cyLeft, LPVOID cyRight, LPVOID pcyResult)');
# my $ret = $VarCyMul->Call($cyLeft, $cyRight, $pcyResult);
# cyLeft : CY -> LPVOID
# cyRight : CY -> LPVOID
# pcyResult : CY* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型