Win32 API 日本語リファレンス
ホームGlobalization › ucurr_getNumericCode

ucurr_getNumericCode

関数
通貨コードに対応するISO数値コードを取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT ucurr_getNumericCode(
    const WORD* currency
);

パラメーター

名前方向
currencyWORD*in

戻り値の型: INT

各言語での呼び出し定義

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

INT ucurr_getNumericCode(
    const WORD* currency
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ucurr_getNumericCode(
    ref ushort currency   // WORD*
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ucurr_getNumericCode(
    ByRef currency As UShort   ' WORD*
) As Integer
End Function
' currency : WORD*
Declare PtrSafe Function ucurr_getNumericCode Lib "icuuc" ( _
    ByRef currency As Integer) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ucurr_getNumericCode = ctypes.cdll.icuuc.ucurr_getNumericCode
ucurr_getNumericCode.restype = ctypes.c_int
ucurr_getNumericCode.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # currency : WORD*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ucurr_getNumericCode = Fiddle::Function.new(
  lib['ucurr_getNumericCode'],
  [
    Fiddle::TYPE_VOIDP,  # currency : WORD*
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ucurr_getNumericCode(
        currency: *const u16  // WORD*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ucurr_getNumericCode(ref ushort currency);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucurr_getNumericCode' -Namespace Win32 -PassThru
# $api::ucurr_getNumericCode(currency)
#uselib "icuuc.dll"
#func global ucurr_getNumericCode "ucurr_getNumericCode" sptr
; ucurr_getNumericCode varptr(currency)   ; 戻り値は stat
; currency : WORD* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global ucurr_getNumericCode "ucurr_getNumericCode" var
; res = ucurr_getNumericCode(currency)
; currency : WORD* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT ucurr_getNumericCode(WORD* currency)
#uselib "icuuc.dll"
#cfunc global ucurr_getNumericCode "ucurr_getNumericCode" var
; res = ucurr_getNumericCode(currency)
; currency : WORD* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucurr_getNumericCode = icuuc.NewProc("ucurr_getNumericCode")
)

// currency (WORD*)
r1, _, err := procucurr_getNumericCode.Call(
	uintptr(currency),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function ucurr_getNumericCode(
  currency: Pointer   // WORD*
): Integer; cdecl;
  external 'icuuc.dll' name 'ucurr_getNumericCode';
result := DllCall("icuuc\ucurr_getNumericCode"
    , "Ptr", currency   ; WORD*
    , "Cdecl Int")   ; return: INT
●ucurr_getNumericCode(currency) = DLL("icuuc.dll", "int ucurr_getNumericCode(void*)")
# 呼び出し: ucurr_getNumericCode(currency)
# currency : WORD* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。