ホーム › UI.Accessibility › UiaNodeFromPoint
UiaNodeFromPoint
関数画面座標位置のUIオートメーションノードを取得する。
シグネチャ
// UIAutomationCore.dll
#include <windows.h>
HRESULT UiaNodeFromPoint(
DOUBLE x,
DOUBLE y,
UiaCacheRequest* pRequest,
SAFEARRAY** ppRequestedData,
LPWSTR* ppTreeStructure
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| x | DOUBLE | in |
| y | DOUBLE | in |
| pRequest | UiaCacheRequest* | inout |
| ppRequestedData | SAFEARRAY** | inout |
| ppTreeStructure | LPWSTR* | inout |
戻り値の型: HRESULT
各言語での呼び出し定義
// UIAutomationCore.dll
#include <windows.h>
HRESULT UiaNodeFromPoint(
DOUBLE x,
DOUBLE y,
UiaCacheRequest* pRequest,
SAFEARRAY** ppRequestedData,
LPWSTR* ppTreeStructure
);[DllImport("UIAutomationCore.dll", ExactSpelling = true)]
static extern int UiaNodeFromPoint(
double x, // DOUBLE
double y, // DOUBLE
IntPtr pRequest, // UiaCacheRequest* in/out
IntPtr ppRequestedData, // SAFEARRAY** in/out
IntPtr ppTreeStructure // LPWSTR* in/out
);<DllImport("UIAutomationCore.dll", ExactSpelling:=True)>
Public Shared Function UiaNodeFromPoint(
x As Double, ' DOUBLE
y As Double, ' DOUBLE
pRequest As IntPtr, ' UiaCacheRequest* in/out
ppRequestedData As IntPtr, ' SAFEARRAY** in/out
ppTreeStructure As IntPtr ' LPWSTR* in/out
) As Integer
End Function' x : DOUBLE
' y : DOUBLE
' pRequest : UiaCacheRequest* in/out
' ppRequestedData : SAFEARRAY** in/out
' ppTreeStructure : LPWSTR* in/out
Declare PtrSafe Function UiaNodeFromPoint Lib "uiautomationcore" ( _
ByVal x As Double, _
ByVal y As Double, _
ByVal pRequest As LongPtr, _
ByVal ppRequestedData As LongPtr, _
ByVal ppTreeStructure As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
UiaNodeFromPoint = ctypes.windll.uiautomationcore.UiaNodeFromPoint
UiaNodeFromPoint.restype = ctypes.c_int
UiaNodeFromPoint.argtypes = [
ctypes.c_double, # x : DOUBLE
ctypes.c_double, # y : DOUBLE
ctypes.c_void_p, # pRequest : UiaCacheRequest* in/out
ctypes.c_void_p, # ppRequestedData : SAFEARRAY** in/out
ctypes.c_void_p, # ppTreeStructure : LPWSTR* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UIAutomationCore.dll')
UiaNodeFromPoint = Fiddle::Function.new(
lib['UiaNodeFromPoint'],
[
Fiddle::TYPE_DOUBLE, # x : DOUBLE
Fiddle::TYPE_DOUBLE, # y : DOUBLE
Fiddle::TYPE_VOIDP, # pRequest : UiaCacheRequest* in/out
Fiddle::TYPE_VOIDP, # ppRequestedData : SAFEARRAY** in/out
Fiddle::TYPE_VOIDP, # ppTreeStructure : LPWSTR* in/out
],
Fiddle::TYPE_INT)#[link(name = "uiautomationcore")]
extern "system" {
fn UiaNodeFromPoint(
x: f64, // DOUBLE
y: f64, // DOUBLE
pRequest: *mut UiaCacheRequest, // UiaCacheRequest* in/out
ppRequestedData: *mut *mut SAFEARRAY, // SAFEARRAY** in/out
ppTreeStructure: *mut *mut u16 // LPWSTR* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("UIAutomationCore.dll")]
public static extern int UiaNodeFromPoint(double x, double y, IntPtr pRequest, IntPtr ppRequestedData, IntPtr ppTreeStructure);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UIAutomationCore_UiaNodeFromPoint' -Namespace Win32 -PassThru
# $api::UiaNodeFromPoint(x, y, pRequest, ppRequestedData, ppTreeStructure)#uselib "UIAutomationCore.dll"
#func global UiaNodeFromPoint "UiaNodeFromPoint" double, double, sptr, sptr, sptr
; UiaNodeFromPoint x, y, varptr(pRequest), varptr(ppRequestedData), varptr(ppTreeStructure) ; 戻り値は stat
; x : DOUBLE -> "double"
; y : DOUBLE -> "double"
; pRequest : UiaCacheRequest* in/out -> "sptr"
; ppRequestedData : SAFEARRAY** in/out -> "sptr"
; ppTreeStructure : LPWSTR* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "UIAutomationCore.dll" #cfunc global UiaNodeFromPoint "UiaNodeFromPoint" double, double, var, var, var ; res = UiaNodeFromPoint(x, y, pRequest, ppRequestedData, ppTreeStructure) ; x : DOUBLE -> "double" ; y : DOUBLE -> "double" ; pRequest : UiaCacheRequest* in/out -> "var" ; ppRequestedData : SAFEARRAY** in/out -> "var" ; ppTreeStructure : LPWSTR* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "UIAutomationCore.dll" #cfunc global UiaNodeFromPoint "UiaNodeFromPoint" double, double, sptr, sptr, sptr ; res = UiaNodeFromPoint(x, y, varptr(pRequest), varptr(ppRequestedData), varptr(ppTreeStructure)) ; x : DOUBLE -> "double" ; y : DOUBLE -> "double" ; pRequest : UiaCacheRequest* in/out -> "sptr" ; ppRequestedData : SAFEARRAY** in/out -> "sptr" ; ppTreeStructure : LPWSTR* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT UiaNodeFromPoint(DOUBLE x, DOUBLE y, UiaCacheRequest* pRequest, SAFEARRAY** ppRequestedData, LPWSTR* ppTreeStructure) #uselib "UIAutomationCore.dll" #cfunc global UiaNodeFromPoint "UiaNodeFromPoint" double, double, var, var, var ; res = UiaNodeFromPoint(x, y, pRequest, ppRequestedData, ppTreeStructure) ; x : DOUBLE -> "double" ; y : DOUBLE -> "double" ; pRequest : UiaCacheRequest* in/out -> "var" ; ppRequestedData : SAFEARRAY** in/out -> "var" ; ppTreeStructure : LPWSTR* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT UiaNodeFromPoint(DOUBLE x, DOUBLE y, UiaCacheRequest* pRequest, SAFEARRAY** ppRequestedData, LPWSTR* ppTreeStructure) #uselib "UIAutomationCore.dll" #cfunc global UiaNodeFromPoint "UiaNodeFromPoint" double, double, intptr, intptr, intptr ; res = UiaNodeFromPoint(x, y, varptr(pRequest), varptr(ppRequestedData), varptr(ppTreeStructure)) ; x : DOUBLE -> "double" ; y : DOUBLE -> "double" ; pRequest : UiaCacheRequest* in/out -> "intptr" ; ppRequestedData : SAFEARRAY** in/out -> "intptr" ; ppTreeStructure : LPWSTR* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
procUiaNodeFromPoint = uiautomationcore.NewProc("UiaNodeFromPoint")
)
// x (DOUBLE), y (DOUBLE), pRequest (UiaCacheRequest* in/out), ppRequestedData (SAFEARRAY** in/out), ppTreeStructure (LPWSTR* in/out)
r1, _, err := procUiaNodeFromPoint.Call(
uintptr(math.Float64bits(x)),
uintptr(math.Float64bits(y)),
uintptr(pRequest),
uintptr(ppRequestedData),
uintptr(ppTreeStructure),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULT
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。function UiaNodeFromPoint(
x: Double; // DOUBLE
y: Double; // DOUBLE
pRequest: Pointer; // UiaCacheRequest* in/out
ppRequestedData: Pointer; // SAFEARRAY** in/out
ppTreeStructure: PPWideChar // LPWSTR* in/out
): Integer; stdcall;
external 'UIAutomationCore.dll' name 'UiaNodeFromPoint';result := DllCall("UIAutomationCore\UiaNodeFromPoint"
, "Double", x ; DOUBLE
, "Double", y ; DOUBLE
, "Ptr", pRequest ; UiaCacheRequest* in/out
, "Ptr", ppRequestedData ; SAFEARRAY** in/out
, "Ptr", ppTreeStructure ; LPWSTR* in/out
, "Int") ; return: HRESULT●UiaNodeFromPoint(x, y, pRequest, ppRequestedData, ppTreeStructure) = DLL("UIAutomationCore.dll", "int UiaNodeFromPoint(double, double, void*, void*, void*)")
# 呼び出し: UiaNodeFromPoint(x, y, pRequest, ppRequestedData, ppTreeStructure)
# x : DOUBLE -> "double"
# y : DOUBLE -> "double"
# pRequest : UiaCacheRequest* in/out -> "void*"
# ppRequestedData : SAFEARRAY** in/out -> "void*"
# ppTreeStructure : LPWSTR* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。