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

ucal_setAttribute

関数
カレンダーの属性値を設定する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

void ucal_setAttribute(
    void** cal,
    UCalendarAttribute attr,
    INT newValue
);

パラメーター

名前方向
calvoid**inout
attrUCalendarAttributein
newValueINTin

戻り値の型: void

各言語での呼び出し定義

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

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

ucal_setAttribute = ctypes.cdll.icuin.ucal_setAttribute
ucal_setAttribute.restype = None
ucal_setAttribute.argtypes = [
    ctypes.c_void_p,  # cal : void** in/out
    ctypes.c_int,  # attr : UCalendarAttribute
    ctypes.c_int,  # newValue : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
ucal_setAttribute = Fiddle::Function.new(
  lib['ucal_setAttribute'],
  [
    Fiddle::TYPE_VOIDP,  # cal : void** in/out
    Fiddle::TYPE_INT,  # attr : UCalendarAttribute
    Fiddle::TYPE_INT,  # newValue : INT
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn ucal_setAttribute(
        cal: *mut *mut (),  // void** in/out
        attr: i32,  // UCalendarAttribute
        newValue: i32  // INT
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ucal_setAttribute(IntPtr cal, int attr, int newValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_ucal_setAttribute' -Namespace Win32 -PassThru
# $api::ucal_setAttribute(cal, attr, newValue)
#uselib "icuin.dll"
#func global ucal_setAttribute "ucal_setAttribute" sptr, sptr, sptr
; ucal_setAttribute cal, attr, newValue
; cal : void** in/out -> "sptr"
; attr : UCalendarAttribute -> "sptr"
; newValue : INT -> "sptr"
#uselib "icuin.dll"
#func global ucal_setAttribute "ucal_setAttribute" sptr, int, int
; ucal_setAttribute cal, attr, newValue
; cal : void** in/out -> "sptr"
; attr : UCalendarAttribute -> "int"
; newValue : INT -> "int"
; void ucal_setAttribute(void** cal, UCalendarAttribute attr, INT newValue)
#uselib "icuin.dll"
#func global ucal_setAttribute "ucal_setAttribute" intptr, int, int
; ucal_setAttribute cal, attr, newValue
; cal : void** in/out -> "intptr"
; attr : UCalendarAttribute -> "int"
; newValue : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procucal_setAttribute = icuin.NewProc("ucal_setAttribute")
)

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