Win32 API 日本語リファレンス
ホームSystem.Console › SetConsoleLocalEUDC

SetConsoleLocalEUDC

関数
コンソールのローカル外字(EUDC)フォントを設定する内部関数。
DLLKERNEL32.dll呼出規約winapi

シグネチャ

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

BOOL SetConsoleLocalEUDC(
    HANDLE hConsoleHandle,
    WORD wCodePoint,
    COORD cFontSize,
    LPSTR lpSB
);

パラメーター

名前方向
hConsoleHandleHANDLEin
wCodePointWORDin
cFontSizeCOORDin
lpSBLPSTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetConsoleLocalEUDC(
    HANDLE hConsoleHandle,
    WORD wCodePoint,
    COORD cFontSize,
    LPSTR lpSB
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool SetConsoleLocalEUDC(
    IntPtr hConsoleHandle,   // HANDLE
    ushort wCodePoint,   // WORD
    COORD cFontSize,   // COORD
    [MarshalAs(UnmanagedType.LPStr)] string lpSB   // LPSTR
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function SetConsoleLocalEUDC(
    hConsoleHandle As IntPtr,   ' HANDLE
    wCodePoint As UShort,   ' WORD
    cFontSize As COORD,   ' COORD
    <MarshalAs(UnmanagedType.LPStr)> lpSB As String   ' LPSTR
) As Boolean
End Function
' hConsoleHandle : HANDLE
' wCodePoint : WORD
' cFontSize : COORD
' lpSB : LPSTR
Declare PtrSafe Function SetConsoleLocalEUDC Lib "kernel32" ( _
    ByVal hConsoleHandle As LongPtr, _
    ByVal wCodePoint As Integer, _
    ByVal cFontSize As LongPtr, _
    ByVal lpSB As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetConsoleLocalEUDC = ctypes.windll.kernel32.SetConsoleLocalEUDC
SetConsoleLocalEUDC.restype = wintypes.BOOL
SetConsoleLocalEUDC.argtypes = [
    wintypes.HANDLE,  # hConsoleHandle : HANDLE
    ctypes.c_ushort,  # wCodePoint : WORD
    COORD,  # cFontSize : COORD
    wintypes.LPCSTR,  # lpSB : LPSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
SetConsoleLocalEUDC = Fiddle::Function.new(
  lib['SetConsoleLocalEUDC'],
  [
    Fiddle::TYPE_VOIDP,  # hConsoleHandle : HANDLE
    -Fiddle::TYPE_SHORT,  # wCodePoint : WORD
    Fiddle::TYPE_VOIDP,  # cFontSize : COORD
    Fiddle::TYPE_VOIDP,  # lpSB : LPSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn SetConsoleLocalEUDC(
        hConsoleHandle: *mut core::ffi::c_void,  // HANDLE
        wCodePoint: u16,  // WORD
        cFontSize: COORD,  // COORD
        lpSB: *mut u8  // LPSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll")]
public static extern bool SetConsoleLocalEUDC(IntPtr hConsoleHandle, ushort wCodePoint, COORD cFontSize, [MarshalAs(UnmanagedType.LPStr)] string lpSB);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_SetConsoleLocalEUDC' -Namespace Win32 -PassThru
# $api::SetConsoleLocalEUDC(hConsoleHandle, wCodePoint, cFontSize, lpSB)
#uselib "KERNEL32.dll"
#func global SetConsoleLocalEUDC "SetConsoleLocalEUDC" sptr, sptr, sptr, sptr
; SetConsoleLocalEUDC hConsoleHandle, wCodePoint, cFontSize, lpSB   ; 戻り値は stat
; hConsoleHandle : HANDLE -> "sptr"
; wCodePoint : WORD -> "sptr"
; cFontSize : COORD -> "sptr"
; lpSB : LPSTR -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global SetConsoleLocalEUDC "SetConsoleLocalEUDC" sptr, int, int, str
; res = SetConsoleLocalEUDC(hConsoleHandle, wCodePoint, cFontSize, lpSB)
; hConsoleHandle : HANDLE -> "sptr"
; wCodePoint : WORD -> "int"
; cFontSize : COORD -> "int"
; lpSB : LPSTR -> "str"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; BOOL SetConsoleLocalEUDC(HANDLE hConsoleHandle, WORD wCodePoint, COORD cFontSize, LPSTR lpSB)
#uselib "KERNEL32.dll"
#cfunc global SetConsoleLocalEUDC "SetConsoleLocalEUDC" intptr, int, int, str
; res = SetConsoleLocalEUDC(hConsoleHandle, wCodePoint, cFontSize, lpSB)
; hConsoleHandle : HANDLE -> "intptr"
; wCodePoint : WORD -> "int"
; cFontSize : COORD -> "int"
; lpSB : LPSTR -> "str"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procSetConsoleLocalEUDC = kernel32.NewProc("SetConsoleLocalEUDC")
)

// hConsoleHandle (HANDLE), wCodePoint (WORD), cFontSize (COORD), lpSB (LPSTR)
r1, _, err := procSetConsoleLocalEUDC.Call(
	uintptr(hConsoleHandle),
	uintptr(wCodePoint),
	uintptr(cFontSize),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpSB))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetConsoleLocalEUDC(
  hConsoleHandle: THandle;   // HANDLE
  wCodePoint: Word;   // WORD
  cFontSize: COORD;   // COORD
  lpSB: PAnsiChar   // LPSTR
): BOOL; stdcall;
  external 'KERNEL32.dll' name 'SetConsoleLocalEUDC';
result := DllCall("KERNEL32\SetConsoleLocalEUDC"
    , "Ptr", hConsoleHandle   ; HANDLE
    , "UShort", wCodePoint   ; WORD
    , "Ptr", cFontSize   ; COORD
    , "AStr", lpSB   ; LPSTR
    , "Int")   ; return: BOOL
●SetConsoleLocalEUDC(hConsoleHandle, wCodePoint, cFontSize, lpSB) = DLL("KERNEL32.dll", "bool SetConsoleLocalEUDC(void*, int, void*, char*)")
# 呼び出し: SetConsoleLocalEUDC(hConsoleHandle, wCodePoint, cFontSize, lpSB)
# hConsoleHandle : HANDLE -> "void*"
# wCodePoint : WORD -> "int"
# cFontSize : COORD -> "void*"
# lpSB : LPSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。