Win32 API 日本語リファレンス
ホームUI.WindowsAndMessaging › ShowCursor

ShowCursor

関数
マウスカーソルの表示カウンタを増減し表示を制御する。
DLLUSER32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

INT ShowCursor(
    BOOL bShow
);

パラメーター

名前方向
bShowBOOLin

戻り値の型: INT

各言語での呼び出し定義

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

INT ShowCursor(
    BOOL bShow
);
[DllImport("USER32.dll", ExactSpelling = true)]
static extern int ShowCursor(
    bool bShow   // BOOL
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function ShowCursor(
    bShow As Boolean   ' BOOL
) As Integer
End Function
' bShow : BOOL
Declare PtrSafe Function ShowCursor Lib "user32" ( _
    ByVal bShow As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ShowCursor = ctypes.windll.user32.ShowCursor
ShowCursor.restype = ctypes.c_int
ShowCursor.argtypes = [
    wintypes.BOOL,  # bShow : BOOL
]
require 'fiddle'
require 'fiddle/import'

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

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procShowCursor = user32.NewProc("ShowCursor")
)

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