Win32 API 日本語リファレンス
ホームSystem.Ole › VarCyMulI4

VarCyMulI4

関数
通貨型(CY)値に符号付き4バイト整数を乗算する。
DLLOLEAUT32.dll呼出規約winapi

シグネチャ

// OLEAUT32.dll
#include <windows.h>

HRESULT VarCyMulI4(
    CY cyLeft,
    INT lRight,
    CY* pcyResult
);

パラメーター

名前方向説明
cyLeftCYin1 番目の variant。
lRightINTin2 番目の variant。
pcyResultCY*out結果の variant。

戻り値の型: HRESULT

公式ドキュメント

currency 値に 32 ビット整数を乗算します。

戻り値

この関数が成功した場合、S_OK を返します。それ以外の場合は、HRESULT エラーコードを返します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// 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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // HRESULT
function 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)。
const std = @import("std");

extern "oleaut32" fn VarCyMulI4(
    cyLeft: CY, // CY
    lRight: i32, // INT
    pcyResult: [*c]CY // CY* out
) callconv(std.os.windows.WINAPI) i32;
proc VarCyMulI4(
    cyLeft: CY,  # CY
    lRight: int32,  # INT
    pcyResult: ptr CY  # CY* out
): int32 {.importc: "VarCyMulI4", stdcall, dynlib: "OLEAUT32.dll".}
pragma(lib, "oleaut32");
extern(Windows)
int VarCyMulI4(
    CY cyLeft,   // CY
    int lRight,   // INT
    CY* pcyResult   // CY* out
);
ccall((:VarCyMulI4, "OLEAUT32.dll"), stdcall, Int32,
      (CY, Int32, Ptr{CY}),
      cyLeft, lRight, pcyResult)
# cyLeft : CY -> CY
# lRight : INT -> Int32
# pcyResult : CY* out -> Ptr{CY}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t VarCyMulI4(
    CY cyLeft,
    int32_t lRight,
    void* pcyResult);
]]
local oleaut32 = ffi.load("oleaut32")
-- oleaut32.VarCyMulI4(cyLeft, lRight, pcyResult)
-- cyLeft : CY
-- lRight : INT
-- pcyResult : CY* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('OLEAUT32.dll');
const VarCyMulI4 = lib.func('__stdcall', 'VarCyMulI4', 'int32_t', ['CY', 'int32_t', 'void *']);
// VarCyMulI4(cyLeft, lRight, pcyResult)
// cyLeft : CY -> 'CY'
// lRight : INT -> 'int32_t'
// pcyResult : CY* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("OLEAUT32.dll", {
  VarCyMulI4: { parameters: ["buffer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.VarCyMulI4(cyLeft, lRight, pcyResult)
// cyLeft : CY -> "buffer"
// lRight : INT -> "i32"
// pcyResult : CY* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t VarCyMulI4(
    CY cyLeft,
    int32_t lRight,
    void* pcyResult);
C, "OLEAUT32.dll");
// $ffi->VarCyMulI4(cyLeft, lRight, pcyResult);
// cyLeft : CY
// lRight : INT
// 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 VarCyMulI4(
        CY /* extends Structure (by value) */ cyLeft,   // CY
        int lRight,   // INT
        Pointer pcyResult   // CY* out
    );
}
@[Link("oleaut32")]
lib LibOLEAUT32
  fun VarCyMulI4 = VarCyMulI4(
    cyLeft : CY,   # CY
    lRight : Int32,   # INT
    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 VarCyMulI4Native = Int32 Function(CY, Int32, Pointer<Void>);
typedef VarCyMulI4Dart = int Function(int, int, Pointer<Void>);
final VarCyMulI4 = DynamicLibrary.open('OLEAUT32.dll')
    .lookupFunction<VarCyMulI4Native, VarCyMulI4Dart>('VarCyMulI4');
// cyLeft : CY -> CY
// lRight : INT -> Int32
// pcyResult : CY* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function VarCyMulI4(
  cyLeft: CY;   // CY
  lRight: Integer;   // INT
  pcyResult: Pointer   // CY* out
): Integer; stdcall;
  external 'OLEAUT32.dll' name 'VarCyMulI4';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "VarCyMulI4"
  c_VarCyMulI4 :: CY -> Int32 -> Ptr () -> IO Int32
-- cyLeft : CY -> CY
-- lRight : INT -> Int32
-- pcyResult : CY* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※値渡し構造体は GHC FFI で直接渡せません。Ptr で渡すラッパ(C側)経由にしてください。
open Ctypes
open Foreign

let varcymuli4 =
  foreign "VarCyMulI4"
    (CY @-> int32_t @-> (ptr void) @-> returning int32_t)
(* cyLeft : CY -> CY *)
(* lRight : INT -> int32_t *)
(* 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 ("VarCyMulI4" var-cy-mul-i4 :convention :stdcall) :int32
  (cy-left (:struct cy))   ; CY
  (l-right :int32)   ; INT
  (pcy-result :pointer))   ; CY* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $VarCyMulI4 = Win32::API::More->new('OLEAUT32',
    'int VarCyMulI4(LPVOID cyLeft, int lRight, LPVOID pcyResult)');
# my $ret = $VarCyMulI4->Call($cyLeft, $lRight, $pcyResult);
# cyLeft : CY -> LPVOID
# lRight : INT -> int
# pcyResult : CY* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API
使用する型