ホーム › UI.Accessibility › UiaEventAddWindow
UiaEventAddWindow
関数UIオートメーションイベントの監視対象ウィンドウを追加する。
シグネチャ
// UIAutomationCore.dll
#include <windows.h>
HRESULT UiaEventAddWindow(
HUIAEVENT hEvent,
HWND hwnd
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hEvent | HUIAEVENT | in |
| hwnd | HWND | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// UIAutomationCore.dll
#include <windows.h>
HRESULT UiaEventAddWindow(
HUIAEVENT hEvent,
HWND hwnd
);[DllImport("UIAutomationCore.dll", ExactSpelling = true)]
static extern int UiaEventAddWindow(
IntPtr hEvent, // HUIAEVENT
IntPtr hwnd // HWND
);<DllImport("UIAutomationCore.dll", ExactSpelling:=True)>
Public Shared Function UiaEventAddWindow(
hEvent As IntPtr, ' HUIAEVENT
hwnd As IntPtr ' HWND
) As Integer
End Function' hEvent : HUIAEVENT
' hwnd : HWND
Declare PtrSafe Function UiaEventAddWindow 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
UiaEventAddWindow = ctypes.windll.uiautomationcore.UiaEventAddWindow
UiaEventAddWindow.restype = ctypes.c_int
UiaEventAddWindow.argtypes = [
wintypes.HANDLE, # hEvent : HUIAEVENT
wintypes.HANDLE, # hwnd : HWND
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UIAutomationCore.dll')
UiaEventAddWindow = Fiddle::Function.new(
lib['UiaEventAddWindow'],
[
Fiddle::TYPE_VOIDP, # hEvent : HUIAEVENT
Fiddle::TYPE_VOIDP, # hwnd : HWND
],
Fiddle::TYPE_INT)#[link(name = "uiautomationcore")]
extern "system" {
fn UiaEventAddWindow(
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 UiaEventAddWindow(IntPtr hEvent, IntPtr hwnd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UIAutomationCore_UiaEventAddWindow' -Namespace Win32 -PassThru
# $api::UiaEventAddWindow(hEvent, hwnd)#uselib "UIAutomationCore.dll"
#func global UiaEventAddWindow "UiaEventAddWindow" sptr, sptr
; UiaEventAddWindow hEvent, hwnd ; 戻り値は stat
; hEvent : HUIAEVENT -> "sptr"
; hwnd : HWND -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "UIAutomationCore.dll"
#cfunc global UiaEventAddWindow "UiaEventAddWindow" sptr, sptr
; res = UiaEventAddWindow(hEvent, hwnd)
; hEvent : HUIAEVENT -> "sptr"
; hwnd : HWND -> "sptr"; HRESULT UiaEventAddWindow(HUIAEVENT hEvent, HWND hwnd)
#uselib "UIAutomationCore.dll"
#cfunc global UiaEventAddWindow "UiaEventAddWindow" intptr, intptr
; res = UiaEventAddWindow(hEvent, hwnd)
; hEvent : HUIAEVENT -> "intptr"
; hwnd : HWND -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
procUiaEventAddWindow = uiautomationcore.NewProc("UiaEventAddWindow")
)
// hEvent (HUIAEVENT), hwnd (HWND)
r1, _, err := procUiaEventAddWindow.Call(
uintptr(hEvent),
uintptr(hwnd),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction UiaEventAddWindow(
hEvent: THandle; // HUIAEVENT
hwnd: THandle // HWND
): Integer; stdcall;
external 'UIAutomationCore.dll' name 'UiaEventAddWindow';result := DllCall("UIAutomationCore\UiaEventAddWindow"
, "Ptr", hEvent ; HUIAEVENT
, "Ptr", hwnd ; HWND
, "Int") ; return: HRESULT●UiaEventAddWindow(hEvent, hwnd) = DLL("UIAutomationCore.dll", "int UiaEventAddWindow(void*, void*)")
# 呼び出し: UiaEventAddWindow(hEvent, hwnd)
# hEvent : HUIAEVENT -> "void*"
# hwnd : HWND -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。