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

TextRange_AddToSelection

関数
テキスト範囲を現在の選択に追加する。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT TextRange_AddToSelection(
    HUIATEXTRANGE hobj
);

パラメーター

名前方向
hobjHUIATEXTRANGEin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

TextRange_AddToSelection = ctypes.windll.uiautomationcore.TextRange_AddToSelection
TextRange_AddToSelection.restype = ctypes.c_int
TextRange_AddToSelection.argtypes = [
    wintypes.HANDLE,  # hobj : HUIATEXTRANGE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('UIAutomationCore.dll')
TextRange_AddToSelection = Fiddle::Function.new(
  lib['TextRange_AddToSelection'],
  [
    Fiddle::TYPE_VOIDP,  # hobj : HUIATEXTRANGE
  ],
  Fiddle::TYPE_INT)
#[link(name = "uiautomationcore")]
extern "system" {
    fn TextRange_AddToSelection(
        hobj: *mut core::ffi::c_void  // HUIATEXTRANGE
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("UIAutomationCore.dll")]
public static extern int TextRange_AddToSelection(IntPtr hobj);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UIAutomationCore_TextRange_AddToSelection' -Namespace Win32 -PassThru
# $api::TextRange_AddToSelection(hobj)
#uselib "UIAutomationCore.dll"
#func global TextRange_AddToSelection "TextRange_AddToSelection" sptr
; TextRange_AddToSelection hobj   ; 戻り値は stat
; hobj : HUIATEXTRANGE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "UIAutomationCore.dll"
#cfunc global TextRange_AddToSelection "TextRange_AddToSelection" sptr
; res = TextRange_AddToSelection(hobj)
; hobj : HUIATEXTRANGE -> "sptr"
; HRESULT TextRange_AddToSelection(HUIATEXTRANGE hobj)
#uselib "UIAutomationCore.dll"
#cfunc global TextRange_AddToSelection "TextRange_AddToSelection" intptr
; res = TextRange_AddToSelection(hobj)
; hobj : HUIATEXTRANGE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procTextRange_AddToSelection = uiautomationcore.NewProc("TextRange_AddToSelection")
)

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