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

UiaEventRemoveWindow

関数
UIオートメーションイベントの監視対象ウィンドウを削除する。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT UiaEventRemoveWindow(
    HUIAEVENT hEvent,
    HWND hwnd
);

パラメーター

名前方向
hEventHUIAEVENTin
hwndHWNDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT UiaEventRemoveWindow(
    HUIAEVENT hEvent,
    HWND hwnd
);
[DllImport("UIAutomationCore.dll", ExactSpelling = true)]
static extern int UiaEventRemoveWindow(
    IntPtr hEvent,   // HUIAEVENT
    IntPtr hwnd   // HWND
);
<DllImport("UIAutomationCore.dll", ExactSpelling:=True)>
Public Shared Function UiaEventRemoveWindow(
    hEvent As IntPtr,   ' HUIAEVENT
    hwnd As IntPtr   ' HWND
) As Integer
End Function
' hEvent : HUIAEVENT
' hwnd : HWND
Declare PtrSafe Function UiaEventRemoveWindow Lib "uiautomationcore" ( _
    ByVal hEvent As LongPtr, _
    ByVal hwnd As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UiaEventRemoveWindow = ctypes.windll.uiautomationcore.UiaEventRemoveWindow
UiaEventRemoveWindow.restype = ctypes.c_int
UiaEventRemoveWindow.argtypes = [
    wintypes.HANDLE,  # hEvent : HUIAEVENT
    wintypes.HANDLE,  # hwnd : HWND
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('UIAutomationCore.dll')
UiaEventRemoveWindow = Fiddle::Function.new(
  lib['UiaEventRemoveWindow'],
  [
    Fiddle::TYPE_VOIDP,  # hEvent : HUIAEVENT
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
  ],
  Fiddle::TYPE_INT)
#[link(name = "uiautomationcore")]
extern "system" {
    fn UiaEventRemoveWindow(
        hEvent: *mut core::ffi::c_void,  // HUIAEVENT
        hwnd: *mut core::ffi::c_void  // HWND
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("UIAutomationCore.dll")]
public static extern int UiaEventRemoveWindow(IntPtr hEvent, IntPtr hwnd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UIAutomationCore_UiaEventRemoveWindow' -Namespace Win32 -PassThru
# $api::UiaEventRemoveWindow(hEvent, hwnd)
#uselib "UIAutomationCore.dll"
#func global UiaEventRemoveWindow "UiaEventRemoveWindow" sptr, sptr
; UiaEventRemoveWindow hEvent, hwnd   ; 戻り値は stat
; hEvent : HUIAEVENT -> "sptr"
; hwnd : HWND -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "UIAutomationCore.dll"
#cfunc global UiaEventRemoveWindow "UiaEventRemoveWindow" sptr, sptr
; res = UiaEventRemoveWindow(hEvent, hwnd)
; hEvent : HUIAEVENT -> "sptr"
; hwnd : HWND -> "sptr"
; HRESULT UiaEventRemoveWindow(HUIAEVENT hEvent, HWND hwnd)
#uselib "UIAutomationCore.dll"
#cfunc global UiaEventRemoveWindow "UiaEventRemoveWindow" intptr, intptr
; res = UiaEventRemoveWindow(hEvent, hwnd)
; hEvent : HUIAEVENT -> "intptr"
; hwnd : HWND -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procUiaEventRemoveWindow = uiautomationcore.NewProc("UiaEventRemoveWindow")
)

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