ホーム › UI.Accessibility › TextRange_ExpandToEnclosingUnit
TextRange_ExpandToEnclosingUnit
関数テキスト範囲を指定単位の境界まで拡張する。
シグネチャ
// UIAutomationCore.dll
#include <windows.h>
HRESULT TextRange_ExpandToEnclosingUnit(
HUIATEXTRANGE hobj,
TextUnit unit
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hobj | HUIATEXTRANGE | in |
| unit | TextUnit | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// UIAutomationCore.dll
#include <windows.h>
HRESULT TextRange_ExpandToEnclosingUnit(
HUIATEXTRANGE hobj,
TextUnit unit
);[DllImport("UIAutomationCore.dll", ExactSpelling = true)]
static extern int TextRange_ExpandToEnclosingUnit(
IntPtr hobj, // HUIATEXTRANGE
int unit // TextUnit
);<DllImport("UIAutomationCore.dll", ExactSpelling:=True)>
Public Shared Function TextRange_ExpandToEnclosingUnit(
hobj As IntPtr, ' HUIATEXTRANGE
unit As Integer ' TextUnit
) As Integer
End Function' hobj : HUIATEXTRANGE
' unit : TextUnit
Declare PtrSafe Function TextRange_ExpandToEnclosingUnit Lib "uiautomationcore" ( _
ByVal hobj As LongPtr, _
ByVal unit As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
TextRange_ExpandToEnclosingUnit = ctypes.windll.uiautomationcore.TextRange_ExpandToEnclosingUnit
TextRange_ExpandToEnclosingUnit.restype = ctypes.c_int
TextRange_ExpandToEnclosingUnit.argtypes = [
wintypes.HANDLE, # hobj : HUIATEXTRANGE
ctypes.c_int, # unit : TextUnit
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UIAutomationCore.dll')
TextRange_ExpandToEnclosingUnit = Fiddle::Function.new(
lib['TextRange_ExpandToEnclosingUnit'],
[
Fiddle::TYPE_VOIDP, # hobj : HUIATEXTRANGE
Fiddle::TYPE_INT, # unit : TextUnit
],
Fiddle::TYPE_INT)#[link(name = "uiautomationcore")]
extern "system" {
fn TextRange_ExpandToEnclosingUnit(
hobj: *mut core::ffi::c_void, // HUIATEXTRANGE
unit: i32 // TextUnit
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("UIAutomationCore.dll")]
public static extern int TextRange_ExpandToEnclosingUnit(IntPtr hobj, int unit);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UIAutomationCore_TextRange_ExpandToEnclosingUnit' -Namespace Win32 -PassThru
# $api::TextRange_ExpandToEnclosingUnit(hobj, unit)#uselib "UIAutomationCore.dll"
#func global TextRange_ExpandToEnclosingUnit "TextRange_ExpandToEnclosingUnit" sptr, sptr
; TextRange_ExpandToEnclosingUnit hobj, unit ; 戻り値は stat
; hobj : HUIATEXTRANGE -> "sptr"
; unit : TextUnit -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "UIAutomationCore.dll"
#cfunc global TextRange_ExpandToEnclosingUnit "TextRange_ExpandToEnclosingUnit" sptr, int
; res = TextRange_ExpandToEnclosingUnit(hobj, unit)
; hobj : HUIATEXTRANGE -> "sptr"
; unit : TextUnit -> "int"; HRESULT TextRange_ExpandToEnclosingUnit(HUIATEXTRANGE hobj, TextUnit unit)
#uselib "UIAutomationCore.dll"
#cfunc global TextRange_ExpandToEnclosingUnit "TextRange_ExpandToEnclosingUnit" intptr, int
; res = TextRange_ExpandToEnclosingUnit(hobj, unit)
; hobj : HUIATEXTRANGE -> "intptr"
; unit : TextUnit -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
procTextRange_ExpandToEnclosingUnit = uiautomationcore.NewProc("TextRange_ExpandToEnclosingUnit")
)
// hobj (HUIATEXTRANGE), unit (TextUnit)
r1, _, err := procTextRange_ExpandToEnclosingUnit.Call(
uintptr(hobj),
uintptr(unit),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction TextRange_ExpandToEnclosingUnit(
hobj: THandle; // HUIATEXTRANGE
unit: Integer // TextUnit
): Integer; stdcall;
external 'UIAutomationCore.dll' name 'TextRange_ExpandToEnclosingUnit';result := DllCall("UIAutomationCore\TextRange_ExpandToEnclosingUnit"
, "Ptr", hobj ; HUIATEXTRANGE
, "Int", unit ; TextUnit
, "Int") ; return: HRESULT●TextRange_ExpandToEnclosingUnit(hobj, unit) = DLL("UIAutomationCore.dll", "int TextRange_ExpandToEnclosingUnit(void*, int)")
# 呼び出し: TextRange_ExpandToEnclosingUnit(hobj, unit)
# hobj : HUIATEXTRANGE -> "void*"
# unit : TextUnit -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。