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

udatpg_setDateTimeFormat

関数
日付と時刻を結合する書式を設定する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

void udatpg_setDateTimeFormat(
    const void** dtpg,
    const WORD* dtFormat,
    INT length
);

パラメーター

名前方向説明
dtpgvoid**in対象のUDateTimePatternGeneratorハンドル。
dtFormatWORD*in日付と時刻を結合する書式文字列。UTF-16配列で指定する。
lengthINTin書式文字列の長さ(UTF-16単位)。-1でNUL終端として扱う。

戻り値の型: void

各言語での呼び出し定義

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

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

udatpg_setDateTimeFormat = ctypes.cdll.icuin.udatpg_setDateTimeFormat
udatpg_setDateTimeFormat.restype = None
udatpg_setDateTimeFormat.argtypes = [
    ctypes.c_void_p,  # dtpg : void**
    ctypes.POINTER(ctypes.c_ushort),  # dtFormat : WORD*
    ctypes.c_int,  # length : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procudatpg_setDateTimeFormat = icuin.NewProc("udatpg_setDateTimeFormat")
)

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

extern "icuin" fn udatpg_setDateTimeFormat(
    dtpg: ?*anyopaque, // void**
    dtFormat: [*c]u16, // WORD*
    length: i32 // INT
) callconv(.c) void;
proc udatpg_setDateTimeFormat(
    dtpg: pointer,  # void**
    dtFormat: ptr uint16,  # WORD*
    length: int32  # INT
) {.importc: "udatpg_setDateTimeFormat", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
void udatpg_setDateTimeFormat(
    void** dtpg,   // void**
    ushort* dtFormat,   // WORD*
    int length   // INT
);
ccall((:udatpg_setDateTimeFormat, "icuin.dll"), Cvoid,
      (Ptr{Cvoid}, Ptr{UInt16}, Int32),
      dtpg, dtFormat, length)
# dtpg : void** -> Ptr{Cvoid}
# dtFormat : WORD* -> Ptr{UInt16}
# length : INT -> Int32
local ffi = require("ffi")
ffi.cdef[[
void udatpg_setDateTimeFormat(
    void** dtpg,
    uint16_t* dtFormat,
    int32_t length);
]]
local icuin = ffi.load("icuin")
-- icuin.udatpg_setDateTimeFormat(dtpg, dtFormat, length)
-- dtpg : void**
-- dtFormat : WORD*
-- length : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const udatpg_setDateTimeFormat = lib.func('__cdecl', 'udatpg_setDateTimeFormat', 'void', ['void *', 'uint16_t *', 'int32_t']);
// udatpg_setDateTimeFormat(dtpg, dtFormat, length)
// dtpg : void** -> 'void *'
// dtFormat : WORD* -> 'uint16_t *'
// length : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  udatpg_setDateTimeFormat: { parameters: ["pointer", "pointer", "i32"], result: "void" },
});
// lib.symbols.udatpg_setDateTimeFormat(dtpg, dtFormat, length)
// dtpg : void** -> "pointer"
// dtFormat : WORD* -> "pointer"
// length : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void udatpg_setDateTimeFormat(
    void** dtpg,
    uint16_t* dtFormat,
    int32_t length);
C, "icuin.dll");
// $ffi->udatpg_setDateTimeFormat(dtpg, dtFormat, length);
// dtpg : void**
// dtFormat : WORD*
// length : INT
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icuin extends Library {
    Icuin INSTANCE = Native.load("icuin", Icuin.class);
    void udatpg_setDateTimeFormat(
        Pointer dtpg,   // void**
        ShortByReference dtFormat,   // WORD*
        int length   // INT
    );
}
@[Link("icuin")]
lib Libicuin
  fun udatpg_setDateTimeFormat = udatpg_setDateTimeFormat(
    dtpg : Void**,   # void**
    dtFormat : UInt16*,   # WORD*
    length : Int32   # INT
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef udatpg_setDateTimeFormatNative = Void Function(Pointer<Void>, Pointer<Uint16>, Int32);
typedef udatpg_setDateTimeFormatDart = void Function(Pointer<Void>, Pointer<Uint16>, int);
final udatpg_setDateTimeFormat = DynamicLibrary.open('icuin.dll')
    .lookupFunction<udatpg_setDateTimeFormatNative, udatpg_setDateTimeFormatDart>('udatpg_setDateTimeFormat');
// dtpg : void** -> Pointer<Void>
// dtFormat : WORD* -> Pointer<Uint16>
// length : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure udatpg_setDateTimeFormat(
  dtpg: Pointer;   // void**
  dtFormat: Pointer;   // WORD*
  length: Integer   // INT
); cdecl;
  external 'icuin.dll' name 'udatpg_setDateTimeFormat';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "udatpg_setDateTimeFormat"
  c_udatpg_setDateTimeFormat :: Ptr () -> Ptr Word16 -> Int32 -> IO ()
-- dtpg : void** -> Ptr ()
-- dtFormat : WORD* -> Ptr Word16
-- length : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let udatpg_setdatetimeformat =
  foreign "udatpg_setDateTimeFormat"
    ((ptr void) @-> (ptr uint16_t) @-> int32_t @-> returning void)
(* dtpg : void** -> (ptr void) *)
(* dtFormat : WORD* -> (ptr uint16_t) *)
(* length : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)

(cffi:defcfun ("udatpg_setDateTimeFormat" udatpg-set-date-time-format :convention :cdecl) :void
  (dtpg :pointer)   ; void**
  (dt-format :pointer)   ; WORD*
  (length :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $udatpg_setDateTimeFormat = Win32::API::More->new('icuin',
    'void udatpg_setDateTimeFormat(LPVOID dtpg, LPVOID dtFormat, int length)');
# my $ret = $udatpg_setDateTimeFormat->Call($dtpg, $dtFormat, $length);
# dtpg : void** -> LPVOID
# dtFormat : WORD* -> LPVOID
# length : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。