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