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

UiaGetRuntimeId

関数
UIオートメーションノードのランタイムIDを取得する。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT UiaGetRuntimeId(
    HUIANODE hnode,
    SAFEARRAY** pruntimeId
);

パラメーター

名前方向
hnodeHUIANODEin
pruntimeIdSAFEARRAY**inout

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

UiaGetRuntimeId = ctypes.windll.uiautomationcore.UiaGetRuntimeId
UiaGetRuntimeId.restype = ctypes.c_int
UiaGetRuntimeId.argtypes = [
    wintypes.HANDLE,  # hnode : HUIANODE
    ctypes.c_void_p,  # pruntimeId : SAFEARRAY** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procUiaGetRuntimeId = uiautomationcore.NewProc("UiaGetRuntimeId")
)

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