ホーム › UI.Accessibility › TextRange_GetBoundingRectangles
TextRange_GetBoundingRectangles
関数テキスト範囲を囲む外接矩形の配列を取得する。
シグネチャ
// UIAutomationCore.dll
#include <windows.h>
HRESULT TextRange_GetBoundingRectangles(
HUIATEXTRANGE hobj,
SAFEARRAY** pRetVal
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hobj | HUIATEXTRANGE | in |
| pRetVal | SAFEARRAY** | inout |
戻り値の型: HRESULT
各言語での呼び出し定義
// UIAutomationCore.dll
#include <windows.h>
HRESULT TextRange_GetBoundingRectangles(
HUIATEXTRANGE hobj,
SAFEARRAY** pRetVal
);[DllImport("UIAutomationCore.dll", ExactSpelling = true)]
static extern int TextRange_GetBoundingRectangles(
IntPtr hobj, // HUIATEXTRANGE
IntPtr pRetVal // SAFEARRAY** in/out
);<DllImport("UIAutomationCore.dll", ExactSpelling:=True)>
Public Shared Function TextRange_GetBoundingRectangles(
hobj As IntPtr, ' HUIATEXTRANGE
pRetVal As IntPtr ' SAFEARRAY** in/out
) As Integer
End Function' hobj : HUIATEXTRANGE
' pRetVal : SAFEARRAY** in/out
Declare PtrSafe Function TextRange_GetBoundingRectangles Lib "uiautomationcore" ( _
ByVal hobj As LongPtr, _
ByVal pRetVal As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
TextRange_GetBoundingRectangles = ctypes.windll.uiautomationcore.TextRange_GetBoundingRectangles
TextRange_GetBoundingRectangles.restype = ctypes.c_int
TextRange_GetBoundingRectangles.argtypes = [
wintypes.HANDLE, # hobj : HUIATEXTRANGE
ctypes.c_void_p, # pRetVal : SAFEARRAY** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UIAutomationCore.dll')
TextRange_GetBoundingRectangles = Fiddle::Function.new(
lib['TextRange_GetBoundingRectangles'],
[
Fiddle::TYPE_VOIDP, # hobj : HUIATEXTRANGE
Fiddle::TYPE_VOIDP, # pRetVal : SAFEARRAY** in/out
],
Fiddle::TYPE_INT)#[link(name = "uiautomationcore")]
extern "system" {
fn TextRange_GetBoundingRectangles(
hobj: *mut core::ffi::c_void, // HUIATEXTRANGE
pRetVal: *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 TextRange_GetBoundingRectangles(IntPtr hobj, IntPtr pRetVal);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UIAutomationCore_TextRange_GetBoundingRectangles' -Namespace Win32 -PassThru
# $api::TextRange_GetBoundingRectangles(hobj, pRetVal)#uselib "UIAutomationCore.dll"
#func global TextRange_GetBoundingRectangles "TextRange_GetBoundingRectangles" sptr, sptr
; TextRange_GetBoundingRectangles hobj, varptr(pRetVal) ; 戻り値は stat
; hobj : HUIATEXTRANGE -> "sptr"
; pRetVal : SAFEARRAY** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "UIAutomationCore.dll" #cfunc global TextRange_GetBoundingRectangles "TextRange_GetBoundingRectangles" sptr, var ; res = TextRange_GetBoundingRectangles(hobj, pRetVal) ; hobj : HUIATEXTRANGE -> "sptr" ; pRetVal : SAFEARRAY** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "UIAutomationCore.dll" #cfunc global TextRange_GetBoundingRectangles "TextRange_GetBoundingRectangles" sptr, sptr ; res = TextRange_GetBoundingRectangles(hobj, varptr(pRetVal)) ; hobj : HUIATEXTRANGE -> "sptr" ; pRetVal : SAFEARRAY** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT TextRange_GetBoundingRectangles(HUIATEXTRANGE hobj, SAFEARRAY** pRetVal) #uselib "UIAutomationCore.dll" #cfunc global TextRange_GetBoundingRectangles "TextRange_GetBoundingRectangles" intptr, var ; res = TextRange_GetBoundingRectangles(hobj, pRetVal) ; hobj : HUIATEXTRANGE -> "intptr" ; pRetVal : SAFEARRAY** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT TextRange_GetBoundingRectangles(HUIATEXTRANGE hobj, SAFEARRAY** pRetVal) #uselib "UIAutomationCore.dll" #cfunc global TextRange_GetBoundingRectangles "TextRange_GetBoundingRectangles" intptr, intptr ; res = TextRange_GetBoundingRectangles(hobj, varptr(pRetVal)) ; hobj : HUIATEXTRANGE -> "intptr" ; pRetVal : SAFEARRAY** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
procTextRange_GetBoundingRectangles = uiautomationcore.NewProc("TextRange_GetBoundingRectangles")
)
// hobj (HUIATEXTRANGE), pRetVal (SAFEARRAY** in/out)
r1, _, err := procTextRange_GetBoundingRectangles.Call(
uintptr(hobj),
uintptr(pRetVal),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction TextRange_GetBoundingRectangles(
hobj: THandle; // HUIATEXTRANGE
pRetVal: Pointer // SAFEARRAY** in/out
): Integer; stdcall;
external 'UIAutomationCore.dll' name 'TextRange_GetBoundingRectangles';result := DllCall("UIAutomationCore\TextRange_GetBoundingRectangles"
, "Ptr", hobj ; HUIATEXTRANGE
, "Ptr", pRetVal ; SAFEARRAY** in/out
, "Int") ; return: HRESULT●TextRange_GetBoundingRectangles(hobj, pRetVal) = DLL("UIAutomationCore.dll", "int TextRange_GetBoundingRectangles(void*, void*)")
# 呼び出し: TextRange_GetBoundingRectangles(hobj, pRetVal)
# hobj : HUIATEXTRANGE -> "void*"
# pRetVal : SAFEARRAY** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。