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

ucal_setTimeZone

関数
カレンダーにタイムゾーンを設定する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

void ucal_setTimeZone(
    void** cal,
    const WORD* zoneID,
    INT len,
    UErrorCode* status
);

パラメーター

名前方向
calvoid**inout
zoneIDWORD*in
lenINTin
statusUErrorCode*inout

戻り値の型: void

各言語での呼び出し定義

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

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

ucal_setTimeZone = ctypes.cdll.icuin.ucal_setTimeZone
ucal_setTimeZone.restype = None
ucal_setTimeZone.argtypes = [
    ctypes.c_void_p,  # cal : void** in/out
    ctypes.POINTER(ctypes.c_ushort),  # zoneID : WORD*
    ctypes.c_int,  # len : INT
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
ucal_setTimeZone = Fiddle::Function.new(
  lib['ucal_setTimeZone'],
  [
    Fiddle::TYPE_VOIDP,  # cal : void** in/out
    Fiddle::TYPE_VOIDP,  # zoneID : WORD*
    Fiddle::TYPE_INT,  # len : INT
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn ucal_setTimeZone(
        cal: *mut *mut (),  // void** in/out
        zoneID: *const u16,  // WORD*
        len: i32,  // INT
        status: *mut i32  // UErrorCode* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ucal_setTimeZone(IntPtr cal, ref ushort zoneID, int len, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucal_setTimeZone' -Namespace Win32 -PassThru
# $api::ucal_setTimeZone(cal, zoneID, len, status)
#uselib "icuin.dll"
#func global ucal_setTimeZone "ucal_setTimeZone" sptr, sptr, sptr, sptr
; ucal_setTimeZone cal, varptr(zoneID), len, status
; cal : void** in/out -> "sptr"
; zoneID : WORD* -> "sptr"
; len : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
出力引数:
#uselib "icuin.dll"
#func global ucal_setTimeZone "ucal_setTimeZone" sptr, var, int, int
; ucal_setTimeZone cal, zoneID, len, status
; cal : void** in/out -> "sptr"
; zoneID : WORD* -> "var"
; len : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void ucal_setTimeZone(void** cal, WORD* zoneID, INT len, UErrorCode* status)
#uselib "icuin.dll"
#func global ucal_setTimeZone "ucal_setTimeZone" intptr, var, int, int
; ucal_setTimeZone cal, zoneID, len, status
; cal : void** in/out -> "intptr"
; zoneID : WORD* -> "var"
; len : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucal_setTimeZone = icuin.NewProc("ucal_setTimeZone")
)

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