ホーム › System.Console › ShowConsoleCursor
ShowConsoleCursor
関数コンソールのカーソルの表示・非表示を切り替える内部関数。
シグネチャ
// KERNEL32.dll
#include <windows.h>
INT ShowConsoleCursor(
HANDLE hConsoleOutput,
BOOL bShow
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hConsoleOutput | HANDLE | in |
| bShow | BOOL | in |
戻り値の型: INT
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
INT ShowConsoleCursor(
HANDLE hConsoleOutput,
BOOL bShow
);[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern int ShowConsoleCursor(
IntPtr hConsoleOutput, // HANDLE
bool bShow // BOOL
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function ShowConsoleCursor(
hConsoleOutput As IntPtr, ' HANDLE
bShow As Boolean ' BOOL
) As Integer
End Function' hConsoleOutput : HANDLE
' bShow : BOOL
Declare PtrSafe Function ShowConsoleCursor Lib "kernel32" ( _
ByVal hConsoleOutput As LongPtr, _
ByVal bShow As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ShowConsoleCursor = ctypes.windll.kernel32.ShowConsoleCursor
ShowConsoleCursor.restype = ctypes.c_int
ShowConsoleCursor.argtypes = [
wintypes.HANDLE, # hConsoleOutput : HANDLE
wintypes.BOOL, # bShow : BOOL
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
ShowConsoleCursor = Fiddle::Function.new(
lib['ShowConsoleCursor'],
[
Fiddle::TYPE_VOIDP, # hConsoleOutput : HANDLE
Fiddle::TYPE_INT, # bShow : BOOL
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn ShowConsoleCursor(
hConsoleOutput: *mut core::ffi::c_void, // HANDLE
bShow: i32 // BOOL
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll")]
public static extern int ShowConsoleCursor(IntPtr hConsoleOutput, bool bShow);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_ShowConsoleCursor' -Namespace Win32 -PassThru
# $api::ShowConsoleCursor(hConsoleOutput, bShow)#uselib "KERNEL32.dll"
#func global ShowConsoleCursor "ShowConsoleCursor" sptr, sptr
; ShowConsoleCursor hConsoleOutput, bShow ; 戻り値は stat
; hConsoleOutput : HANDLE -> "sptr"
; bShow : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global ShowConsoleCursor "ShowConsoleCursor" sptr, int
; res = ShowConsoleCursor(hConsoleOutput, bShow)
; hConsoleOutput : HANDLE -> "sptr"
; bShow : BOOL -> "int"; INT ShowConsoleCursor(HANDLE hConsoleOutput, BOOL bShow)
#uselib "KERNEL32.dll"
#cfunc global ShowConsoleCursor "ShowConsoleCursor" intptr, int
; res = ShowConsoleCursor(hConsoleOutput, bShow)
; hConsoleOutput : HANDLE -> "intptr"
; bShow : BOOL -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procShowConsoleCursor = kernel32.NewProc("ShowConsoleCursor")
)
// hConsoleOutput (HANDLE), bShow (BOOL)
r1, _, err := procShowConsoleCursor.Call(
uintptr(hConsoleOutput),
uintptr(bShow),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ShowConsoleCursor(
hConsoleOutput: THandle; // HANDLE
bShow: BOOL // BOOL
): Integer; stdcall;
external 'KERNEL32.dll' name 'ShowConsoleCursor';result := DllCall("KERNEL32\ShowConsoleCursor"
, "Ptr", hConsoleOutput ; HANDLE
, "Int", bShow ; BOOL
, "Int") ; return: INT●ShowConsoleCursor(hConsoleOutput, bShow) = DLL("KERNEL32.dll", "int ShowConsoleCursor(void*, bool)")
# 呼び出し: ShowConsoleCursor(hConsoleOutput, bShow)
# hConsoleOutput : HANDLE -> "void*"
# bShow : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。