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

UiaRaiseNotificationEvent

関数
支援技術へ通知を伝えるUIオートメーションイベントを発生させる。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT UiaRaiseNotificationEvent(
    IRawElementProviderSimple* provider,
    NotificationKind notificationKind,
    NotificationProcessing notificationProcessing,
    LPWSTR displayString,   // optional
    LPWSTR activityId
);

パラメーター

名前方向説明
providerIRawElementProviderSimple*in通知イベントを発生させる要素のプロバイダーへのポインター。
notificationKindNotificationKindin通知の種類(項目追加・アクション完了など)を示すNotificationKind値。
notificationProcessingNotificationProcessingin通知の処理方法(重要・全て処理・最新を保持など)を示すNotificationProcessing値。
displayStringLPWSTRinoptional支援技術が読み上げる通知メッセージ文字列。
activityIdLPWSTRin関連する通知をまとめるためのアクティビティ識別子文字列。NULL可。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT UiaRaiseNotificationEvent(
    IRawElementProviderSimple* provider,
    NotificationKind notificationKind,
    NotificationProcessing notificationProcessing,
    LPWSTR displayString,   // optional
    LPWSTR activityId
);
[DllImport("UIAutomationCore.dll", ExactSpelling = true)]
static extern int UiaRaiseNotificationEvent(
    IntPtr provider,   // IRawElementProviderSimple*
    int notificationKind,   // NotificationKind
    int notificationProcessing,   // NotificationProcessing
    [MarshalAs(UnmanagedType.LPWStr)] string displayString,   // LPWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string activityId   // LPWSTR
);
<DllImport("UIAutomationCore.dll", ExactSpelling:=True)>
Public Shared Function UiaRaiseNotificationEvent(
    provider As IntPtr,   ' IRawElementProviderSimple*
    notificationKind As Integer,   ' NotificationKind
    notificationProcessing As Integer,   ' NotificationProcessing
    <MarshalAs(UnmanagedType.LPWStr)> displayString As String,   ' LPWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> activityId As String   ' LPWSTR
) As Integer
End Function
' provider : IRawElementProviderSimple*
' notificationKind : NotificationKind
' notificationProcessing : NotificationProcessing
' displayString : LPWSTR optional
' activityId : LPWSTR
Declare PtrSafe Function UiaRaiseNotificationEvent Lib "uiautomationcore" ( _
    ByVal provider As LongPtr, _
    ByVal notificationKind As Long, _
    ByVal notificationProcessing As Long, _
    ByVal displayString As LongPtr, _
    ByVal activityId As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UiaRaiseNotificationEvent = ctypes.windll.uiautomationcore.UiaRaiseNotificationEvent
UiaRaiseNotificationEvent.restype = ctypes.c_int
UiaRaiseNotificationEvent.argtypes = [
    ctypes.c_void_p,  # provider : IRawElementProviderSimple*
    ctypes.c_int,  # notificationKind : NotificationKind
    ctypes.c_int,  # notificationProcessing : NotificationProcessing
    wintypes.LPCWSTR,  # displayString : LPWSTR optional
    wintypes.LPCWSTR,  # activityId : LPWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procUiaRaiseNotificationEvent = uiautomationcore.NewProc("UiaRaiseNotificationEvent")
)

// provider (IRawElementProviderSimple*), notificationKind (NotificationKind), notificationProcessing (NotificationProcessing), displayString (LPWSTR optional), activityId (LPWSTR)
r1, _, err := procUiaRaiseNotificationEvent.Call(
	uintptr(provider),
	uintptr(notificationKind),
	uintptr(notificationProcessing),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(displayString))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(activityId))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function UiaRaiseNotificationEvent(
  provider: Pointer;   // IRawElementProviderSimple*
  notificationKind: Integer;   // NotificationKind
  notificationProcessing: Integer;   // NotificationProcessing
  displayString: PWideChar;   // LPWSTR optional
  activityId: PWideChar   // LPWSTR
): Integer; stdcall;
  external 'UIAutomationCore.dll' name 'UiaRaiseNotificationEvent';
result := DllCall("UIAutomationCore\UiaRaiseNotificationEvent"
    , "Ptr", provider   ; IRawElementProviderSimple*
    , "Int", notificationKind   ; NotificationKind
    , "Int", notificationProcessing   ; NotificationProcessing
    , "WStr", displayString   ; LPWSTR optional
    , "WStr", activityId   ; LPWSTR
    , "Int")   ; return: HRESULT
●UiaRaiseNotificationEvent(provider, notificationKind, notificationProcessing, displayString, activityId) = DLL("UIAutomationCore.dll", "int UiaRaiseNotificationEvent(void*, int, int, char*, char*)")
# 呼び出し: UiaRaiseNotificationEvent(provider, notificationKind, notificationProcessing, displayString, activityId)
# provider : IRawElementProviderSimple* -> "void*"
# notificationKind : NotificationKind -> "int"
# notificationProcessing : NotificationProcessing -> "int"
# displayString : LPWSTR optional -> "char*"
# activityId : LPWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "uiautomationcore" fn UiaRaiseNotificationEvent(
    provider: ?*anyopaque, // IRawElementProviderSimple*
    notificationKind: i32, // NotificationKind
    notificationProcessing: i32, // NotificationProcessing
    displayString: [*c]const u16, // LPWSTR optional
    activityId: [*c]const u16 // LPWSTR
) callconv(std.os.windows.WINAPI) i32;
proc UiaRaiseNotificationEvent(
    provider: pointer,  # IRawElementProviderSimple*
    notificationKind: int32,  # NotificationKind
    notificationProcessing: int32,  # NotificationProcessing
    displayString: WideCString,  # LPWSTR optional
    activityId: WideCString  # LPWSTR
): int32 {.importc: "UiaRaiseNotificationEvent", stdcall, dynlib: "UIAutomationCore.dll".}
pragma(lib, "uiautomationcore");
extern(Windows)
int UiaRaiseNotificationEvent(
    void* provider,   // IRawElementProviderSimple*
    int notificationKind,   // NotificationKind
    int notificationProcessing,   // NotificationProcessing
    const(wchar)* displayString,   // LPWSTR optional
    const(wchar)* activityId   // LPWSTR
);
ccall((:UiaRaiseNotificationEvent, "UIAutomationCore.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Int32, Int32, Cwstring, Cwstring),
      provider, notificationKind, notificationProcessing, displayString, activityId)
# provider : IRawElementProviderSimple* -> Ptr{Cvoid}
# notificationKind : NotificationKind -> Int32
# notificationProcessing : NotificationProcessing -> Int32
# displayString : LPWSTR optional -> Cwstring
# activityId : LPWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t UiaRaiseNotificationEvent(
    void* provider,
    int32_t notificationKind,
    int32_t notificationProcessing,
    const uint16_t* displayString,
    const uint16_t* activityId);
]]
local uiautomationcore = ffi.load("uiautomationcore")
-- uiautomationcore.UiaRaiseNotificationEvent(provider, notificationKind, notificationProcessing, displayString, activityId)
-- provider : IRawElementProviderSimple*
-- notificationKind : NotificationKind
-- notificationProcessing : NotificationProcessing
-- displayString : LPWSTR optional
-- activityId : LPWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('UIAutomationCore.dll');
const UiaRaiseNotificationEvent = lib.func('__stdcall', 'UiaRaiseNotificationEvent', 'int32_t', ['void *', 'int32_t', 'int32_t', 'str16', 'str16']);
// UiaRaiseNotificationEvent(provider, notificationKind, notificationProcessing, displayString, activityId)
// provider : IRawElementProviderSimple* -> 'void *'
// notificationKind : NotificationKind -> 'int32_t'
// notificationProcessing : NotificationProcessing -> 'int32_t'
// displayString : LPWSTR optional -> 'str16'
// activityId : LPWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("UIAutomationCore.dll", {
  UiaRaiseNotificationEvent: { parameters: ["pointer", "i32", "i32", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.UiaRaiseNotificationEvent(provider, notificationKind, notificationProcessing, displayString, activityId)
// provider : IRawElementProviderSimple* -> "pointer"
// notificationKind : NotificationKind -> "i32"
// notificationProcessing : NotificationProcessing -> "i32"
// displayString : LPWSTR optional -> "buffer"
// activityId : LPWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t UiaRaiseNotificationEvent(
    void* provider,
    int32_t notificationKind,
    int32_t notificationProcessing,
    const uint16_t* displayString,
    const uint16_t* activityId);
C, "UIAutomationCore.dll");
// $ffi->UiaRaiseNotificationEvent(provider, notificationKind, notificationProcessing, displayString, activityId);
// provider : IRawElementProviderSimple*
// notificationKind : NotificationKind
// notificationProcessing : NotificationProcessing
// displayString : LPWSTR optional
// activityId : LPWSTR
// 構造体/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 UiaRaiseNotificationEvent(
        Pointer provider,   // IRawElementProviderSimple*
        int notificationKind,   // NotificationKind
        int notificationProcessing,   // NotificationProcessing
        WString displayString,   // LPWSTR optional
        WString activityId   // LPWSTR
    );
}
@[Link("uiautomationcore")]
lib LibUIAutomationCore
  fun UiaRaiseNotificationEvent = UiaRaiseNotificationEvent(
    provider : Void*,   # IRawElementProviderSimple*
    notificationKind : Int32,   # NotificationKind
    notificationProcessing : Int32,   # NotificationProcessing
    displayString : UInt16*,   # LPWSTR optional
    activityId : UInt16*   # LPWSTR
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef UiaRaiseNotificationEventNative = Int32 Function(Pointer<Void>, Int32, Int32, Pointer<Utf16>, Pointer<Utf16>);
typedef UiaRaiseNotificationEventDart = int Function(Pointer<Void>, int, int, Pointer<Utf16>, Pointer<Utf16>);
final UiaRaiseNotificationEvent = DynamicLibrary.open('UIAutomationCore.dll')
    .lookupFunction<UiaRaiseNotificationEventNative, UiaRaiseNotificationEventDart>('UiaRaiseNotificationEvent');
// provider : IRawElementProviderSimple* -> Pointer<Void>
// notificationKind : NotificationKind -> Int32
// notificationProcessing : NotificationProcessing -> Int32
// displayString : LPWSTR optional -> Pointer<Utf16>
// activityId : LPWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function UiaRaiseNotificationEvent(
  provider: Pointer;   // IRawElementProviderSimple*
  notificationKind: Integer;   // NotificationKind
  notificationProcessing: Integer;   // NotificationProcessing
  displayString: PWideChar;   // LPWSTR optional
  activityId: PWideChar   // LPWSTR
): Integer; stdcall;
  external 'UIAutomationCore.dll' name 'UiaRaiseNotificationEvent';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "UiaRaiseNotificationEvent"
  c_UiaRaiseNotificationEvent :: Ptr () -> Int32 -> Int32 -> CWString -> CWString -> IO Int32
-- provider : IRawElementProviderSimple* -> Ptr ()
-- notificationKind : NotificationKind -> Int32
-- notificationProcessing : NotificationProcessing -> Int32
-- displayString : LPWSTR optional -> CWString
-- activityId : LPWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let uiaraisenotificationevent =
  foreign "UiaRaiseNotificationEvent"
    ((ptr void) @-> int32_t @-> int32_t @-> (ptr uint16_t) @-> (ptr uint16_t) @-> returning int32_t)
(* provider : IRawElementProviderSimple* -> (ptr void) *)
(* notificationKind : NotificationKind -> int32_t *)
(* notificationProcessing : NotificationProcessing -> int32_t *)
(* displayString : LPWSTR optional -> (ptr uint16_t) *)
(* activityId : LPWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library uiautomationcore (t "UIAutomationCore.dll"))
(cffi:use-foreign-library uiautomationcore)

(cffi:defcfun ("UiaRaiseNotificationEvent" uia-raise-notification-event :convention :stdcall) :int32
  (provider :pointer)   ; IRawElementProviderSimple*
  (notification-kind :int32)   ; NotificationKind
  (notification-processing :int32)   ; NotificationProcessing
  (display-string (:string :encoding :utf-16le))   ; LPWSTR optional
  (activity-id (:string :encoding :utf-16le)))   ; LPWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $UiaRaiseNotificationEvent = Win32::API::More->new('UIAutomationCore',
    'int UiaRaiseNotificationEvent(LPVOID provider, int notificationKind, int notificationProcessing, LPCWSTR displayString, LPCWSTR activityId)');
# my $ret = $UiaRaiseNotificationEvent->Call($provider, $notificationKind, $notificationProcessing, $displayString, $activityId);
# provider : IRawElementProviderSimple* -> LPVOID
# notificationKind : NotificationKind -> int
# notificationProcessing : NotificationProcessing -> int
# displayString : LPWSTR optional -> LPCWSTR
# activityId : LPWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型