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

UiaRaiseAutomationEvent

関数
UIオートメーションの汎用イベントを発生させる。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT UiaRaiseAutomationEvent(
    IRawElementProviderSimple* pProvider,
    UIA_EVENT_ID id
);

パラメーター

名前方向
pProviderIRawElementProviderSimple*in
idUIA_EVENT_IDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

UiaRaiseAutomationEvent = ctypes.windll.uiautomationcore.UiaRaiseAutomationEvent
UiaRaiseAutomationEvent.restype = ctypes.c_int
UiaRaiseAutomationEvent.argtypes = [
    ctypes.c_void_p,  # pProvider : IRawElementProviderSimple*
    ctypes.c_int,  # id : UIA_EVENT_ID
]
require 'fiddle'
require 'fiddle/import'

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

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procUiaRaiseAutomationEvent = uiautomationcore.NewProc("UiaRaiseAutomationEvent")
)

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