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

umsg_setLocale

関数
メッセージフォーマッタのロケールを設定する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

void umsg_setLocale(
    void** fmt,
    LPCSTR locale
);

パラメーター

名前方向
fmtvoid**inout
localeLPCSTRin

戻り値の型: void

各言語での呼び出し定義

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

void umsg_setLocale(
    void** fmt,
    LPCSTR locale
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void umsg_setLocale(
    IntPtr fmt,   // void** in/out
    [MarshalAs(UnmanagedType.LPStr)] string locale   // LPCSTR
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub umsg_setLocale(
    fmt As IntPtr,   ' void** in/out
    <MarshalAs(UnmanagedType.LPStr)> locale As String   ' LPCSTR
)
End Sub
' fmt : void** in/out
' locale : LPCSTR
Declare PtrSafe Sub umsg_setLocale Lib "icuin" ( _
    ByVal fmt As LongPtr, _
    ByVal locale As String)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

umsg_setLocale = ctypes.cdll.icuin.umsg_setLocale
umsg_setLocale.restype = None
umsg_setLocale.argtypes = [
    ctypes.c_void_p,  # fmt : void** in/out
    wintypes.LPCSTR,  # locale : LPCSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
umsg_setLocale = Fiddle::Function.new(
  lib['umsg_setLocale'],
  [
    Fiddle::TYPE_VOIDP,  # fmt : void** in/out
    Fiddle::TYPE_VOIDP,  # locale : LPCSTR
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn umsg_setLocale(
        fmt: *mut *mut (),  // void** in/out
        locale: *const u8  // LPCSTR
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void umsg_setLocale(IntPtr fmt, [MarshalAs(UnmanagedType.LPStr)] string locale);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_umsg_setLocale' -Namespace Win32 -PassThru
# $api::umsg_setLocale(fmt, locale)
#uselib "icuin.dll"
#func global umsg_setLocale "umsg_setLocale" sptr, sptr
; umsg_setLocale fmt, locale
; fmt : void** in/out -> "sptr"
; locale : LPCSTR -> "sptr"
#uselib "icuin.dll"
#func global umsg_setLocale "umsg_setLocale" sptr, str
; umsg_setLocale fmt, locale
; fmt : void** in/out -> "sptr"
; locale : LPCSTR -> "str"
; void umsg_setLocale(void** fmt, LPCSTR locale)
#uselib "icuin.dll"
#func global umsg_setLocale "umsg_setLocale" intptr, str
; umsg_setLocale fmt, locale
; fmt : void** in/out -> "intptr"
; locale : LPCSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procumsg_setLocale = icuin.NewProc("umsg_setLocale")
)

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