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

umsg_getLocale

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

シグネチャ

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

LPSTR umsg_getLocale(
    const void** fmt
);

パラメーター

名前方向説明
fmtvoid**inロケールを取得するUMessageFormatハンドル。

戻り値の型: LPSTR

各言語での呼び出し定義

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

LPSTR umsg_getLocale(
    const void** fmt
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr umsg_getLocale(
    IntPtr fmt   // void**
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function umsg_getLocale(
    fmt As IntPtr   ' void**
) As IntPtr
End Function
' fmt : void**
Declare PtrSafe Function umsg_getLocale Lib "icuin" ( _
    ByVal fmt As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

umsg_getLocale = ctypes.cdll.icuin.umsg_getLocale
umsg_getLocale.restype = wintypes.LPSTR
umsg_getLocale.argtypes = [
    ctypes.c_void_p,  # fmt : void**
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
umsg_getLocale = Fiddle::Function.new(
  lib['umsg_getLocale'],
  [
    Fiddle::TYPE_VOIDP,  # fmt : void**
  ],
  Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn umsg_getLocale(
        fmt: *const *const ()  // void**
    ) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr umsg_getLocale(IntPtr fmt);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_umsg_getLocale' -Namespace Win32 -PassThru
# $api::umsg_getLocale(fmt)
#uselib "icuin.dll"
#func global umsg_getLocale "umsg_getLocale" sptr
; umsg_getLocale fmt   ; 戻り値は stat
; fmt : void** -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuin.dll"
#cfunc global umsg_getLocale "umsg_getLocale" sptr
; res = umsg_getLocale(fmt)
; fmt : void** -> "sptr"
; LPSTR umsg_getLocale(void** fmt)
#uselib "icuin.dll"
#cfunc global umsg_getLocale "umsg_getLocale" intptr
; res = umsg_getLocale(fmt)
; fmt : void** -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procumsg_getLocale = icuin.NewProc("umsg_getLocale")
)

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

extern "icuin" fn umsg_getLocale(
    fmt: ?*anyopaque // void**
) callconv(.c) [*c]const u8;
proc umsg_getLocale(
    fmt: pointer  # void**
): cstring {.importc: "umsg_getLocale", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
const(char)* umsg_getLocale(
    void** fmt   // void**
);
ccall((:umsg_getLocale, "icuin.dll"), Cstring,
      (Ptr{Cvoid},),
      fmt)
# fmt : void** -> Ptr{Cvoid}
local ffi = require("ffi")
ffi.cdef[[
const char* umsg_getLocale(
    void** fmt);
]]
local icuin = ffi.load("icuin")
-- icuin.umsg_getLocale(fmt)
-- fmt : void**
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const umsg_getLocale = lib.func('__cdecl', 'umsg_getLocale', 'void *', ['void *']);
// umsg_getLocale(fmt)
// fmt : void** -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  umsg_getLocale: { parameters: ["pointer"], result: "pointer" },
});
// lib.symbols.umsg_getLocale(fmt)
// fmt : void** -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
const char* umsg_getLocale(
    void** fmt);
C, "icuin.dll");
// $ffi->umsg_getLocale(fmt);
// fmt : void**
// 構造体/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);
    Pointer umsg_getLocale(
        Pointer fmt   // void**
    );
}
@[Link("icuin")]
lib Libicuin
  fun umsg_getLocale = umsg_getLocale(
    fmt : Void**   # void**
  ) : UInt8*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef umsg_getLocaleNative = Pointer<Utf8> Function(Pointer<Void>);
typedef umsg_getLocaleDart = Pointer<Utf8> Function(Pointer<Void>);
final umsg_getLocale = DynamicLibrary.open('icuin.dll')
    .lookupFunction<umsg_getLocaleNative, umsg_getLocaleDart>('umsg_getLocale');
// fmt : void** -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function umsg_getLocale(
  fmt: Pointer   // void**
): PAnsiChar; cdecl;
  external 'icuin.dll' name 'umsg_getLocale';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "umsg_getLocale"
  c_umsg_getLocale :: Ptr () -> IO CString
-- fmt : void** -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let umsg_getlocale =
  foreign "umsg_getLocale"
    ((ptr void) @-> returning string)
(* fmt : void** -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)

(cffi:defcfun ("umsg_getLocale" umsg-get-locale :convention :cdecl) :string
  (fmt :pointer))   ; void**
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $umsg_getLocale = Win32::API::More->new('icuin',
    'LPSTR umsg_getLocale(LPVOID fmt)');
# my $ret = $umsg_getLocale->Call($fmt);
# fmt : void** -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。