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

SetConsoleOS2OemFormat

関数
コンソールのOS/2向けOEM出力形式を設定する内部関数。
DLLKERNEL32.dll呼出規約winapi

シグネチャ

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

BOOL SetConsoleOS2OemFormat(
    BOOL fOs2OemFormat
);

パラメーター

名前方向
fOs2OemFormatBOOLin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetConsoleOS2OemFormat(
    BOOL fOs2OemFormat
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool SetConsoleOS2OemFormat(
    bool fOs2OemFormat   // BOOL
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function SetConsoleOS2OemFormat(
    fOs2OemFormat As Boolean   ' BOOL
) As Boolean
End Function
' fOs2OemFormat : BOOL
Declare PtrSafe Function SetConsoleOS2OemFormat Lib "kernel32" ( _
    ByVal fOs2OemFormat As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetConsoleOS2OemFormat = ctypes.windll.kernel32.SetConsoleOS2OemFormat
SetConsoleOS2OemFormat.restype = wintypes.BOOL
SetConsoleOS2OemFormat.argtypes = [
    wintypes.BOOL,  # fOs2OemFormat : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
SetConsoleOS2OemFormat = Fiddle::Function.new(
  lib['SetConsoleOS2OemFormat'],
  [
    Fiddle::TYPE_INT,  # fOs2OemFormat : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn SetConsoleOS2OemFormat(
        fOs2OemFormat: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll")]
public static extern bool SetConsoleOS2OemFormat(bool fOs2OemFormat);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_SetConsoleOS2OemFormat' -Namespace Win32 -PassThru
# $api::SetConsoleOS2OemFormat(fOs2OemFormat)
#uselib "KERNEL32.dll"
#func global SetConsoleOS2OemFormat "SetConsoleOS2OemFormat" sptr
; SetConsoleOS2OemFormat fOs2OemFormat   ; 戻り値は stat
; fOs2OemFormat : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global SetConsoleOS2OemFormat "SetConsoleOS2OemFormat" int
; res = SetConsoleOS2OemFormat(fOs2OemFormat)
; fOs2OemFormat : BOOL -> "int"
; BOOL SetConsoleOS2OemFormat(BOOL fOs2OemFormat)
#uselib "KERNEL32.dll"
#cfunc global SetConsoleOS2OemFormat "SetConsoleOS2OemFormat" int
; res = SetConsoleOS2OemFormat(fOs2OemFormat)
; fOs2OemFormat : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procSetConsoleOS2OemFormat = kernel32.NewProc("SetConsoleOS2OemFormat")
)

// fOs2OemFormat (BOOL)
r1, _, err := procSetConsoleOS2OemFormat.Call(
	uintptr(fOs2OemFormat),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetConsoleOS2OemFormat(
  fOs2OemFormat: BOOL   // BOOL
): BOOL; stdcall;
  external 'KERNEL32.dll' name 'SetConsoleOS2OemFormat';
result := DllCall("KERNEL32\SetConsoleOS2OemFormat"
    , "Int", fOs2OemFormat   ; BOOL
    , "Int")   ; return: BOOL
●SetConsoleOS2OemFormat(fOs2OemFormat) = DLL("KERNEL32.dll", "bool SetConsoleOS2OemFormat(bool)")
# 呼び出し: SetConsoleOS2OemFormat(fOs2OemFormat)
# fOs2OemFormat : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。