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

UiaRaiseStructureChangedEvent

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

シグネチャ

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

HRESULT UiaRaiseStructureChangedEvent(
    IRawElementProviderSimple* pProvider,
    StructureChangeType structureChangeType,
    INT* pRuntimeId,
    INT cRuntimeIdLen
);

パラメーター

名前方向説明
pProviderIRawElementProviderSimple*in構造変更イベントを発生させる要素のプロバイダーへのポインター。
structureChangeTypeStructureChangeTypein構造変更の種類(子の追加・削除など)を示すStructureChangeType値。
pRuntimeIdINT*inout変更に関係する要素のランタイムIDを格納した整数配列。子削除時に対象を示す。
cRuntimeIdLenINTinpRuntimeId配列の要素数。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

UiaRaiseStructureChangedEvent = ctypes.windll.uiautomationcore.UiaRaiseStructureChangedEvent
UiaRaiseStructureChangedEvent.restype = ctypes.c_int
UiaRaiseStructureChangedEvent.argtypes = [
    ctypes.c_void_p,  # pProvider : IRawElementProviderSimple*
    ctypes.c_int,  # structureChangeType : StructureChangeType
    ctypes.POINTER(ctypes.c_int),  # pRuntimeId : INT* in/out
    ctypes.c_int,  # cRuntimeIdLen : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('UIAutomationCore.dll')
UiaRaiseStructureChangedEvent = Fiddle::Function.new(
  lib['UiaRaiseStructureChangedEvent'],
  [
    Fiddle::TYPE_VOIDP,  # pProvider : IRawElementProviderSimple*
    Fiddle::TYPE_INT,  # structureChangeType : StructureChangeType
    Fiddle::TYPE_VOIDP,  # pRuntimeId : INT* in/out
    Fiddle::TYPE_INT,  # cRuntimeIdLen : INT
  ],
  Fiddle::TYPE_INT)
#[link(name = "uiautomationcore")]
extern "system" {
    fn UiaRaiseStructureChangedEvent(
        pProvider: *mut core::ffi::c_void,  // IRawElementProviderSimple*
        structureChangeType: i32,  // StructureChangeType
        pRuntimeId: *mut i32,  // INT* in/out
        cRuntimeIdLen: i32  // INT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("UIAutomationCore.dll")]
public static extern int UiaRaiseStructureChangedEvent(IntPtr pProvider, int structureChangeType, ref int pRuntimeId, int cRuntimeIdLen);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UIAutomationCore_UiaRaiseStructureChangedEvent' -Namespace Win32 -PassThru
# $api::UiaRaiseStructureChangedEvent(pProvider, structureChangeType, pRuntimeId, cRuntimeIdLen)
#uselib "UIAutomationCore.dll"
#func global UiaRaiseStructureChangedEvent "UiaRaiseStructureChangedEvent" sptr, sptr, sptr, sptr
; UiaRaiseStructureChangedEvent pProvider, structureChangeType, varptr(pRuntimeId), cRuntimeIdLen   ; 戻り値は stat
; pProvider : IRawElementProviderSimple* -> "sptr"
; structureChangeType : StructureChangeType -> "sptr"
; pRuntimeId : INT* in/out -> "sptr"
; cRuntimeIdLen : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "UIAutomationCore.dll"
#cfunc global UiaRaiseStructureChangedEvent "UiaRaiseStructureChangedEvent" sptr, int, var, int
; res = UiaRaiseStructureChangedEvent(pProvider, structureChangeType, pRuntimeId, cRuntimeIdLen)
; pProvider : IRawElementProviderSimple* -> "sptr"
; structureChangeType : StructureChangeType -> "int"
; pRuntimeId : INT* in/out -> "var"
; cRuntimeIdLen : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT UiaRaiseStructureChangedEvent(IRawElementProviderSimple* pProvider, StructureChangeType structureChangeType, INT* pRuntimeId, INT cRuntimeIdLen)
#uselib "UIAutomationCore.dll"
#cfunc global UiaRaiseStructureChangedEvent "UiaRaiseStructureChangedEvent" intptr, int, var, int
; res = UiaRaiseStructureChangedEvent(pProvider, structureChangeType, pRuntimeId, cRuntimeIdLen)
; pProvider : IRawElementProviderSimple* -> "intptr"
; structureChangeType : StructureChangeType -> "int"
; pRuntimeId : INT* in/out -> "var"
; cRuntimeIdLen : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procUiaRaiseStructureChangedEvent = uiautomationcore.NewProc("UiaRaiseStructureChangedEvent")
)

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

extern "uiautomationcore" fn UiaRaiseStructureChangedEvent(
    pProvider: ?*anyopaque, // IRawElementProviderSimple*
    structureChangeType: i32, // StructureChangeType
    pRuntimeId: [*c]i32, // INT* in/out
    cRuntimeIdLen: i32 // INT
) callconv(std.os.windows.WINAPI) i32;
proc UiaRaiseStructureChangedEvent(
    pProvider: pointer,  # IRawElementProviderSimple*
    structureChangeType: int32,  # StructureChangeType
    pRuntimeId: ptr int32,  # INT* in/out
    cRuntimeIdLen: int32  # INT
): int32 {.importc: "UiaRaiseStructureChangedEvent", stdcall, dynlib: "UIAutomationCore.dll".}
pragma(lib, "uiautomationcore");
extern(Windows)
int UiaRaiseStructureChangedEvent(
    void* pProvider,   // IRawElementProviderSimple*
    int structureChangeType,   // StructureChangeType
    int* pRuntimeId,   // INT* in/out
    int cRuntimeIdLen   // INT
);
ccall((:UiaRaiseStructureChangedEvent, "UIAutomationCore.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Int32, Ptr{Int32}, Int32),
      pProvider, structureChangeType, pRuntimeId, cRuntimeIdLen)
# pProvider : IRawElementProviderSimple* -> Ptr{Cvoid}
# structureChangeType : StructureChangeType -> Int32
# pRuntimeId : INT* in/out -> Ptr{Int32}
# cRuntimeIdLen : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t UiaRaiseStructureChangedEvent(
    void* pProvider,
    int32_t structureChangeType,
    int32_t* pRuntimeId,
    int32_t cRuntimeIdLen);
]]
local uiautomationcore = ffi.load("uiautomationcore")
-- uiautomationcore.UiaRaiseStructureChangedEvent(pProvider, structureChangeType, pRuntimeId, cRuntimeIdLen)
-- pProvider : IRawElementProviderSimple*
-- structureChangeType : StructureChangeType
-- pRuntimeId : INT* in/out
-- cRuntimeIdLen : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('UIAutomationCore.dll');
const UiaRaiseStructureChangedEvent = lib.func('__stdcall', 'UiaRaiseStructureChangedEvent', 'int32_t', ['void *', 'int32_t', 'int32_t *', 'int32_t']);
// UiaRaiseStructureChangedEvent(pProvider, structureChangeType, pRuntimeId, cRuntimeIdLen)
// pProvider : IRawElementProviderSimple* -> 'void *'
// structureChangeType : StructureChangeType -> 'int32_t'
// pRuntimeId : INT* in/out -> 'int32_t *'
// cRuntimeIdLen : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("UIAutomationCore.dll", {
  UiaRaiseStructureChangedEvent: { parameters: ["pointer", "i32", "pointer", "i32"], result: "i32" },
});
// lib.symbols.UiaRaiseStructureChangedEvent(pProvider, structureChangeType, pRuntimeId, cRuntimeIdLen)
// pProvider : IRawElementProviderSimple* -> "pointer"
// structureChangeType : StructureChangeType -> "i32"
// pRuntimeId : INT* in/out -> "pointer"
// cRuntimeIdLen : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t UiaRaiseStructureChangedEvent(
    void* pProvider,
    int32_t structureChangeType,
    int32_t* pRuntimeId,
    int32_t cRuntimeIdLen);
C, "UIAutomationCore.dll");
// $ffi->UiaRaiseStructureChangedEvent(pProvider, structureChangeType, pRuntimeId, cRuntimeIdLen);
// pProvider : IRawElementProviderSimple*
// structureChangeType : StructureChangeType
// pRuntimeId : INT* in/out
// cRuntimeIdLen : INT
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Uiautomationcore extends StdCallLibrary {
    Uiautomationcore INSTANCE = Native.load("uiautomationcore", Uiautomationcore.class);
    int UiaRaiseStructureChangedEvent(
        Pointer pProvider,   // IRawElementProviderSimple*
        int structureChangeType,   // StructureChangeType
        IntByReference pRuntimeId,   // INT* in/out
        int cRuntimeIdLen   // INT
    );
}
@[Link("uiautomationcore")]
lib LibUIAutomationCore
  fun UiaRaiseStructureChangedEvent = UiaRaiseStructureChangedEvent(
    pProvider : Void*,   # IRawElementProviderSimple*
    structureChangeType : Int32,   # StructureChangeType
    pRuntimeId : Int32*,   # INT* in/out
    cRuntimeIdLen : Int32   # INT
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef UiaRaiseStructureChangedEventNative = Int32 Function(Pointer<Void>, Int32, Pointer<Int32>, Int32);
typedef UiaRaiseStructureChangedEventDart = int Function(Pointer<Void>, int, Pointer<Int32>, int);
final UiaRaiseStructureChangedEvent = DynamicLibrary.open('UIAutomationCore.dll')
    .lookupFunction<UiaRaiseStructureChangedEventNative, UiaRaiseStructureChangedEventDart>('UiaRaiseStructureChangedEvent');
// pProvider : IRawElementProviderSimple* -> Pointer<Void>
// structureChangeType : StructureChangeType -> Int32
// pRuntimeId : INT* in/out -> Pointer<Int32>
// cRuntimeIdLen : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function UiaRaiseStructureChangedEvent(
  pProvider: Pointer;   // IRawElementProviderSimple*
  structureChangeType: Integer;   // StructureChangeType
  pRuntimeId: Pointer;   // INT* in/out
  cRuntimeIdLen: Integer   // INT
): Integer; stdcall;
  external 'UIAutomationCore.dll' name 'UiaRaiseStructureChangedEvent';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "UiaRaiseStructureChangedEvent"
  c_UiaRaiseStructureChangedEvent :: Ptr () -> Int32 -> Ptr Int32 -> Int32 -> IO Int32
-- pProvider : IRawElementProviderSimple* -> Ptr ()
-- structureChangeType : StructureChangeType -> Int32
-- pRuntimeId : INT* in/out -> Ptr Int32
-- cRuntimeIdLen : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let uiaraisestructurechangedevent =
  foreign "UiaRaiseStructureChangedEvent"
    ((ptr void) @-> int32_t @-> (ptr int32_t) @-> int32_t @-> returning int32_t)
(* pProvider : IRawElementProviderSimple* -> (ptr void) *)
(* structureChangeType : StructureChangeType -> int32_t *)
(* pRuntimeId : INT* in/out -> (ptr int32_t) *)
(* cRuntimeIdLen : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library uiautomationcore (t "UIAutomationCore.dll"))
(cffi:use-foreign-library uiautomationcore)

(cffi:defcfun ("UiaRaiseStructureChangedEvent" uia-raise-structure-changed-event :convention :stdcall) :int32
  (p-provider :pointer)   ; IRawElementProviderSimple*
  (structure-change-type :int32)   ; StructureChangeType
  (p-runtime-id :pointer)   ; INT* in/out
  (c-runtime-id-len :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $UiaRaiseStructureChangedEvent = Win32::API::More->new('UIAutomationCore',
    'int UiaRaiseStructureChangedEvent(LPVOID pProvider, int structureChangeType, LPVOID pRuntimeId, int cRuntimeIdLen)');
# my $ret = $UiaRaiseStructureChangedEvent->Call($pProvider, $structureChangeType, $pRuntimeId, $cRuntimeIdLen);
# pProvider : IRawElementProviderSimple* -> LPVOID
# structureChangeType : StructureChangeType -> int
# pRuntimeId : INT* in/out -> LPVOID
# cRuntimeIdLen : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型