ホーム › UI.Input.KeyboardAndMouse › BlockInput
BlockInput
関数キーボードとマウスの入力をブロックまたは解除する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL BlockInput(
BOOL fBlockIt
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| fBlockIt | BOOL | in |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL BlockInput(
BOOL fBlockIt
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool BlockInput(
bool fBlockIt // BOOL
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function BlockInput(
fBlockIt As Boolean ' BOOL
) As Boolean
End Function' fBlockIt : BOOL
Declare PtrSafe Function BlockInput Lib "user32" ( _
ByVal fBlockIt As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BlockInput = ctypes.windll.user32.BlockInput
BlockInput.restype = wintypes.BOOL
BlockInput.argtypes = [
wintypes.BOOL, # fBlockIt : BOOL
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
BlockInput = Fiddle::Function.new(
lib['BlockInput'],
[
Fiddle::TYPE_INT, # fBlockIt : BOOL
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn BlockInput(
fBlockIt: i32 // BOOL
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true)]
public static extern bool BlockInput(bool fBlockIt);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_BlockInput' -Namespace Win32 -PassThru
# $api::BlockInput(fBlockIt)#uselib "USER32.dll"
#func global BlockInput "BlockInput" sptr
; BlockInput fBlockIt ; 戻り値は stat
; fBlockIt : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global BlockInput "BlockInput" int
; res = BlockInput(fBlockIt)
; fBlockIt : BOOL -> "int"; BOOL BlockInput(BOOL fBlockIt)
#uselib "USER32.dll"
#cfunc global BlockInput "BlockInput" int
; res = BlockInput(fBlockIt)
; fBlockIt : BOOL -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procBlockInput = user32.NewProc("BlockInput")
)
// fBlockIt (BOOL)
r1, _, err := procBlockInput.Call(
uintptr(fBlockIt),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction BlockInput(
fBlockIt: BOOL // BOOL
): BOOL; stdcall;
external 'USER32.dll' name 'BlockInput';result := DllCall("USER32\BlockInput"
, "Int", fBlockIt ; BOOL
, "Int") ; return: BOOL●BlockInput(fBlockIt) = DLL("USER32.dll", "bool BlockInput(bool)")
# 呼び出し: BlockInput(fBlockIt)
# fBlockIt : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。