ホーム › Globalization › uldn_languageDisplayName
uldn_languageDisplayName
関数指定言語コードの表示名を生成して取得する。
シグネチャ
// icuuc.dll
#include <windows.h>
INT uldn_languageDisplayName(
const ULocaleDisplayNames* ldn,
LPCSTR lang,
WORD* result,
INT maxResultSize,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ldn | ULocaleDisplayNames* | in |
| lang | LPCSTR | in |
| result | WORD* | inout |
| maxResultSize | INT | in |
| pErrorCode | UErrorCode* | inout |
戻り値の型: INT
各言語での呼び出し定義
// icuuc.dll
#include <windows.h>
INT uldn_languageDisplayName(
const ULocaleDisplayNames* ldn,
LPCSTR lang,
WORD* result,
INT maxResultSize,
UErrorCode* pErrorCode
);[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uldn_languageDisplayName(
ref IntPtr ldn, // ULocaleDisplayNames*
[MarshalAs(UnmanagedType.LPStr)] string lang, // 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_languageDisplayName(
ByRef ldn As IntPtr, ' ULocaleDisplayNames*
<MarshalAs(UnmanagedType.LPStr)> lang 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*
' lang : LPCSTR
' result : WORD* in/out
' maxResultSize : INT
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function uldn_languageDisplayName Lib "icuuc" ( _
ByRef ldn As LongPtr, _
ByVal lang 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_languageDisplayName = ctypes.cdll.icuuc.uldn_languageDisplayName
uldn_languageDisplayName.restype = ctypes.c_int
uldn_languageDisplayName.argtypes = [
ctypes.c_void_p, # ldn : ULocaleDisplayNames*
wintypes.LPCSTR, # lang : 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_languageDisplayName = Fiddle::Function.new(
lib['uldn_languageDisplayName'],
[
Fiddle::TYPE_VOIDP, # ldn : ULocaleDisplayNames*
Fiddle::TYPE_VOIDP, # lang : 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_languageDisplayName(
ldn: *const isize, // ULocaleDisplayNames*
lang: *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_languageDisplayName(ref IntPtr ldn, [MarshalAs(UnmanagedType.LPStr)] string lang, ref ushort result, int maxResultSize, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uldn_languageDisplayName' -Namespace Win32 -PassThru
# $api::uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode)#uselib "icuuc.dll"
#func global uldn_languageDisplayName "uldn_languageDisplayName" sptr, sptr, sptr, sptr, sptr
; uldn_languageDisplayName ldn, lang, varptr(result), maxResultSize, pErrorCode ; 戻り値は stat
; ldn : ULocaleDisplayNames* -> "sptr"
; lang : 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_languageDisplayName "uldn_languageDisplayName" int, str, var, int, int ; res = uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode) ; ldn : ULocaleDisplayNames* -> "int" ; lang : LPCSTR -> "str" ; result : WORD* in/out -> "var" ; maxResultSize : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuuc.dll" #cfunc global uldn_languageDisplayName "uldn_languageDisplayName" int, str, sptr, int, int ; res = uldn_languageDisplayName(ldn, lang, varptr(result), maxResultSize, pErrorCode) ; ldn : ULocaleDisplayNames* -> "int" ; lang : LPCSTR -> "str" ; result : WORD* in/out -> "sptr" ; maxResultSize : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT uldn_languageDisplayName(ULocaleDisplayNames* ldn, LPCSTR lang, WORD* result, INT maxResultSize, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global uldn_languageDisplayName "uldn_languageDisplayName" int, str, var, int, int ; res = uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode) ; ldn : ULocaleDisplayNames* -> "int" ; lang : LPCSTR -> "str" ; result : WORD* in/out -> "var" ; maxResultSize : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT uldn_languageDisplayName(ULocaleDisplayNames* ldn, LPCSTR lang, WORD* result, INT maxResultSize, UErrorCode* pErrorCode) #uselib "icuuc.dll" #cfunc global uldn_languageDisplayName "uldn_languageDisplayName" int, str, intptr, int, int ; res = uldn_languageDisplayName(ldn, lang, varptr(result), maxResultSize, pErrorCode) ; ldn : ULocaleDisplayNames* -> "int" ; lang : LPCSTR -> "str" ; result : WORD* in/out -> "intptr" ; maxResultSize : INT -> "int" ; pErrorCode : UErrorCode* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuuc = windows.NewLazySystemDLL("icuuc.dll")
proculdn_languageDisplayName = icuuc.NewProc("uldn_languageDisplayName")
)
// ldn (ULocaleDisplayNames*), lang (LPCSTR), result (WORD* in/out), maxResultSize (INT), pErrorCode (UErrorCode* in/out)
r1, _, err := proculdn_languageDisplayName.Call(
uintptr(ldn),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lang))),
uintptr(result),
uintptr(maxResultSize),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction uldn_languageDisplayName(
ldn: Pointer; // ULocaleDisplayNames*
lang: PAnsiChar; // LPCSTR
result: Pointer; // WORD* in/out
maxResultSize: Integer; // INT
pErrorCode: Pointer // UErrorCode* in/out
): Integer; cdecl;
external 'icuuc.dll' name 'uldn_languageDisplayName';result := DllCall("icuuc\uldn_languageDisplayName"
, "Ptr", ldn ; ULocaleDisplayNames*
, "AStr", lang ; LPCSTR
, "Ptr", result ; WORD* in/out
, "Int", maxResultSize ; INT
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Int") ; return: INT●uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode) = DLL("icuuc.dll", "int uldn_languageDisplayName(void*, char*, void*, int, void*)")
# 呼び出し: uldn_languageDisplayName(ldn, lang, result, maxResultSize, pErrorCode)
# ldn : ULocaleDisplayNames* -> "void*"
# lang : 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`,…) を使用。