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
notificationProcessingNotificationProcessingin
displayStringLPWSTRinoptional
activityIdLPWSTRin

戻り値の型: 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)。