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

ucal_getWindowsTimeZoneID

関数
ICUのタイムゾーンIDをWindowsのタイムゾーンIDへ変換する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

INT ucal_getWindowsTimeZoneID(
    const WORD* id,
    INT len,
    WORD* winid,
    INT winidCapacity,
    UErrorCode* status
);

パラメーター

名前方向
idWORD*in
lenINTin
winidWORD*inout
winidCapacityINTin
statusUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

ucal_getWindowsTimeZoneID = ctypes.cdll.icuin.ucal_getWindowsTimeZoneID
ucal_getWindowsTimeZoneID.restype = ctypes.c_int
ucal_getWindowsTimeZoneID.argtypes = [
    ctypes.POINTER(ctypes.c_ushort),  # id : WORD*
    ctypes.c_int,  # len : INT
    ctypes.POINTER(ctypes.c_ushort),  # winid : WORD* in/out
    ctypes.c_int,  # winidCapacity : INT
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucal_getWindowsTimeZoneID = icuin.NewProc("ucal_getWindowsTimeZoneID")
)

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