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

uldn_keyDisplayName

関数
ロケールキーワードキーの表示名を生成して取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT uldn_keyDisplayName(
    const ULocaleDisplayNames* ldn,
    LPCSTR key,
    WORD* result,
    INT maxResultSize,
    UErrorCode* pErrorCode
);

パラメーター

名前方向
ldnULocaleDisplayNames*in
keyLPCSTRin
resultWORD*inout
maxResultSizeINTin
pErrorCodeUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

INT uldn_keyDisplayName(
    const ULocaleDisplayNames* ldn,
    LPCSTR key,
    WORD* result,
    INT maxResultSize,
    UErrorCode* pErrorCode
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uldn_keyDisplayName(
    ref IntPtr ldn,   // ULocaleDisplayNames*
    [MarshalAs(UnmanagedType.LPStr)] string key,   // LPCSTR
    ref ushort result,   // WORD* in/out
    int maxResultSize,   // INT
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uldn_keyDisplayName(
    ByRef ldn As IntPtr,   ' ULocaleDisplayNames*
    <MarshalAs(UnmanagedType.LPStr)> key As String,   ' LPCSTR
    ByRef result As UShort,   ' WORD* in/out
    maxResultSize As Integer,   ' INT
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As Integer
End Function
' ldn : ULocaleDisplayNames*
' key : LPCSTR
' result : WORD* in/out
' maxResultSize : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function uldn_keyDisplayName Lib "icuuc" ( _
    ByRef ldn As LongPtr, _
    ByVal key As String, _
    ByRef result As Integer, _
    ByVal maxResultSize As Long, _
    ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uldn_keyDisplayName = ctypes.cdll.icuuc.uldn_keyDisplayName
uldn_keyDisplayName.restype = ctypes.c_int
uldn_keyDisplayName.argtypes = [
    ctypes.c_void_p,  # ldn : ULocaleDisplayNames*
    wintypes.LPCSTR,  # key : LPCSTR
    ctypes.POINTER(ctypes.c_ushort),  # result : WORD* in/out
    ctypes.c_int,  # maxResultSize : INT
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
uldn_keyDisplayName = Fiddle::Function.new(
  lib['uldn_keyDisplayName'],
  [
    Fiddle::TYPE_VOIDP,  # ldn : ULocaleDisplayNames*
    Fiddle::TYPE_VOIDP,  # key : LPCSTR
    Fiddle::TYPE_VOIDP,  # result : WORD* in/out
    Fiddle::TYPE_INT,  # maxResultSize : INT
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn uldn_keyDisplayName(
        ldn: *const isize,  // ULocaleDisplayNames*
        key: *const u8,  // LPCSTR
        result: *mut u16,  // WORD* in/out
        maxResultSize: i32,  // INT
        pErrorCode: *mut i32  // UErrorCode* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int uldn_keyDisplayName(ref IntPtr ldn, [MarshalAs(UnmanagedType.LPStr)] string key, ref ushort result, int maxResultSize, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uldn_keyDisplayName' -Namespace Win32 -PassThru
# $api::uldn_keyDisplayName(ldn, key, result, maxResultSize, pErrorCode)
#uselib "icuuc.dll"
#func global uldn_keyDisplayName "uldn_keyDisplayName" sptr, sptr, sptr, sptr, sptr
; uldn_keyDisplayName ldn, key, varptr(result), maxResultSize, pErrorCode   ; 戻り値は stat
; ldn : ULocaleDisplayNames* -> "sptr"
; key : LPCSTR -> "sptr"
; result : WORD* in/out -> "sptr"
; maxResultSize : INT -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global uldn_keyDisplayName "uldn_keyDisplayName" int, str, var, int, int
; res = uldn_keyDisplayName(ldn, key, result, maxResultSize, pErrorCode)
; ldn : ULocaleDisplayNames* -> "int"
; key : LPCSTR -> "str"
; result : WORD* in/out -> "var"
; maxResultSize : INT -> "int"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT uldn_keyDisplayName(ULocaleDisplayNames* ldn, LPCSTR key, WORD* result, INT maxResultSize, UErrorCode* pErrorCode)
#uselib "icuuc.dll"
#cfunc global uldn_keyDisplayName "uldn_keyDisplayName" int, str, var, int, int
; res = uldn_keyDisplayName(ldn, key, result, maxResultSize, pErrorCode)
; ldn : ULocaleDisplayNames* -> "int"
; key : LPCSTR -> "str"
; result : WORD* in/out -> "var"
; maxResultSize : INT -> "int"
; pErrorCode : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	proculdn_keyDisplayName = icuuc.NewProc("uldn_keyDisplayName")
)

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