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

NotifyWinEvent

関数
WinEventフックへアクセシビリティイベントを通知する。
DLLUSER32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

void NotifyWinEvent(
    DWORD event,
    HWND hwnd,
    INT idObject,
    INT idChild
);

パラメーター

名前方向
eventDWORDin
hwndHWNDin
idObjectINTin
idChildINTin

戻り値の型: void

各言語での呼び出し定義

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

void NotifyWinEvent(
    DWORD event,
    HWND hwnd,
    INT idObject,
    INT idChild
);
[DllImport("USER32.dll", ExactSpelling = true)]
static extern void NotifyWinEvent(
    uint event,   // DWORD
    IntPtr hwnd,   // HWND
    int idObject,   // INT
    int idChild   // INT
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Sub NotifyWinEvent(
    [event] As UInteger,   ' DWORD
    hwnd As IntPtr,   ' HWND
    idObject As Integer,   ' INT
    idChild As Integer   ' INT
)
End Sub
' event : DWORD
' hwnd : HWND
' idObject : INT
' idChild : INT
Declare PtrSafe Sub NotifyWinEvent Lib "user32" ( _
    ByVal event As Long, _
    ByVal hwnd As LongPtr, _
    ByVal idObject As Long, _
    ByVal idChild As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NotifyWinEvent = ctypes.windll.user32.NotifyWinEvent
NotifyWinEvent.restype = None
NotifyWinEvent.argtypes = [
    wintypes.DWORD,  # event : DWORD
    wintypes.HANDLE,  # hwnd : HWND
    ctypes.c_int,  # idObject : INT
    ctypes.c_int,  # idChild : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
NotifyWinEvent = Fiddle::Function.new(
  lib['NotifyWinEvent'],
  [
    -Fiddle::TYPE_INT,  # event : DWORD
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
    Fiddle::TYPE_INT,  # idObject : INT
    Fiddle::TYPE_INT,  # idChild : INT
  ],
  Fiddle::TYPE_VOID)
#[link(name = "user32")]
extern "system" {
    fn NotifyWinEvent(
        event: u32,  // DWORD
        hwnd: *mut core::ffi::c_void,  // HWND
        idObject: i32,  // INT
        idChild: i32  // INT
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("USER32.dll")]
public static extern void NotifyWinEvent(uint event, IntPtr hwnd, int idObject, int idChild);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_NotifyWinEvent' -Namespace Win32 -PassThru
# $api::NotifyWinEvent(event, hwnd, idObject, idChild)
#uselib "USER32.dll"
#func global NotifyWinEvent "NotifyWinEvent" sptr, sptr, sptr, sptr
; NotifyWinEvent event, hwnd, idObject, idChild
; event : DWORD -> "sptr"
; hwnd : HWND -> "sptr"
; idObject : INT -> "sptr"
; idChild : INT -> "sptr"
#uselib "USER32.dll"
#func global NotifyWinEvent "NotifyWinEvent" int, sptr, int, int
; NotifyWinEvent event, hwnd, idObject, idChild
; event : DWORD -> "int"
; hwnd : HWND -> "sptr"
; idObject : INT -> "int"
; idChild : INT -> "int"
; void NotifyWinEvent(DWORD event, HWND hwnd, INT idObject, INT idChild)
#uselib "USER32.dll"
#func global NotifyWinEvent "NotifyWinEvent" int, intptr, int, int
; NotifyWinEvent event, hwnd, idObject, idChild
; event : DWORD -> "int"
; hwnd : HWND -> "intptr"
; idObject : INT -> "int"
; idChild : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procNotifyWinEvent = user32.NewProc("NotifyWinEvent")
)

// event (DWORD), hwnd (HWND), idObject (INT), idChild (INT)
r1, _, err := procNotifyWinEvent.Call(
	uintptr(event),
	uintptr(hwnd),
	uintptr(idObject),
	uintptr(idChild),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure NotifyWinEvent(
  event: DWORD;   // DWORD
  hwnd: THandle;   // HWND
  idObject: Integer;   // INT
  idChild: Integer   // INT
); stdcall;
  external 'USER32.dll' name 'NotifyWinEvent';
result := DllCall("USER32\NotifyWinEvent"
    , "UInt", event   ; DWORD
    , "Ptr", hwnd   ; HWND
    , "Int", idObject   ; INT
    , "Int", idChild   ; INT
    , "Int")   ; return: void
●NotifyWinEvent(event, hwnd, idObject, idChild) = DLL("USER32.dll", "int NotifyWinEvent(dword, void*, int, int)")
# 呼び出し: NotifyWinEvent(event, hwnd, idObject, idChild)
# event : DWORD -> "dword"
# hwnd : HWND -> "void*"
# idObject : INT -> "int"
# idChild : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。