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

TransformPattern_Move

関数
Transformパターンで要素を指定座標へ移動する。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT TransformPattern_Move(
    HUIAPATTERNOBJECT hobj,
    DOUBLE x,
    DOUBLE y
);

パラメーター

名前方向説明
hobjHUIAPATTERNOBJECTinTransformPatternを表すパターンオブジェクトハンドル。
xDOUBLEin移動先の左上X座標(スクリーン座標、倍精度)。
yDOUBLEin移動先の左上Y座標(スクリーン座標、倍精度)。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

TransformPattern_Move = ctypes.windll.uiautomationcore.TransformPattern_Move
TransformPattern_Move.restype = ctypes.c_int
TransformPattern_Move.argtypes = [
    wintypes.HANDLE,  # hobj : HUIAPATTERNOBJECT
    ctypes.c_double,  # x : DOUBLE
    ctypes.c_double,  # y : DOUBLE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procTransformPattern_Move = uiautomationcore.NewProc("TransformPattern_Move")
)

// hobj (HUIAPATTERNOBJECT), x (DOUBLE), y (DOUBLE)
r1, _, err := procTransformPattern_Move.Call(
	uintptr(hobj),
	uintptr(math.Float64bits(x)),
	uintptr(math.Float64bits(y)),
)
_ = 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 TransformPattern_Move(
  hobj: THandle;   // HUIAPATTERNOBJECT
  x: Double;   // DOUBLE
  y: Double   // DOUBLE
): Integer; stdcall;
  external 'UIAutomationCore.dll' name 'TransformPattern_Move';
result := DllCall("UIAutomationCore\TransformPattern_Move"
    , "Ptr", hobj   ; HUIAPATTERNOBJECT
    , "Double", x   ; DOUBLE
    , "Double", y   ; DOUBLE
    , "Int")   ; return: HRESULT
●TransformPattern_Move(hobj, x, y) = DLL("UIAutomationCore.dll", "int TransformPattern_Move(void*, double, double)")
# 呼び出し: TransformPattern_Move(hobj, x, y)
# hobj : HUIAPATTERNOBJECT -> "void*"
# x : DOUBLE -> "double"
# y : DOUBLE -> "double"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "uiautomationcore" fn TransformPattern_Move(
    hobj: ?*anyopaque, // HUIAPATTERNOBJECT
    x: f64, // DOUBLE
    y: f64 // DOUBLE
) callconv(std.os.windows.WINAPI) i32;
proc TransformPattern_Move(
    hobj: pointer,  # HUIAPATTERNOBJECT
    x: float64,  # DOUBLE
    y: float64  # DOUBLE
): int32 {.importc: "TransformPattern_Move", stdcall, dynlib: "UIAutomationCore.dll".}
pragma(lib, "uiautomationcore");
extern(Windows)
int TransformPattern_Move(
    void* hobj,   // HUIAPATTERNOBJECT
    double x,   // DOUBLE
    double y   // DOUBLE
);
ccall((:TransformPattern_Move, "UIAutomationCore.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Float64, Float64),
      hobj, x, y)
# hobj : HUIAPATTERNOBJECT -> Ptr{Cvoid}
# x : DOUBLE -> Float64
# y : DOUBLE -> Float64
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t TransformPattern_Move(
    void* hobj,
    double x,
    double y);
]]
local uiautomationcore = ffi.load("uiautomationcore")
-- uiautomationcore.TransformPattern_Move(hobj, x, y)
-- hobj : HUIAPATTERNOBJECT
-- x : DOUBLE
-- y : DOUBLE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('UIAutomationCore.dll');
const TransformPattern_Move = lib.func('__stdcall', 'TransformPattern_Move', 'int32_t', ['void *', 'double', 'double']);
// TransformPattern_Move(hobj, x, y)
// hobj : HUIAPATTERNOBJECT -> 'void *'
// x : DOUBLE -> 'double'
// y : DOUBLE -> 'double'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("UIAutomationCore.dll", {
  TransformPattern_Move: { parameters: ["pointer", "f64", "f64"], result: "i32" },
});
// lib.symbols.TransformPattern_Move(hobj, x, y)
// hobj : HUIAPATTERNOBJECT -> "pointer"
// x : DOUBLE -> "f64"
// y : DOUBLE -> "f64"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t TransformPattern_Move(
    void* hobj,
    double x,
    double y);
C, "UIAutomationCore.dll");
// $ffi->TransformPattern_Move(hobj, x, y);
// hobj : HUIAPATTERNOBJECT
// x : DOUBLE
// y : DOUBLE
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Uiautomationcore extends StdCallLibrary {
    Uiautomationcore INSTANCE = Native.load("uiautomationcore", Uiautomationcore.class);
    int TransformPattern_Move(
        Pointer hobj,   // HUIAPATTERNOBJECT
        double x,   // DOUBLE
        double y   // DOUBLE
    );
}
@[Link("uiautomationcore")]
lib LibUIAutomationCore
  fun TransformPattern_Move = TransformPattern_Move(
    hobj : Void*,   # HUIAPATTERNOBJECT
    x : Float64,   # DOUBLE
    y : Float64   # DOUBLE
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef TransformPattern_MoveNative = Int32 Function(Pointer<Void>, Double, Double);
typedef TransformPattern_MoveDart = int Function(Pointer<Void>, double, double);
final TransformPattern_Move = DynamicLibrary.open('UIAutomationCore.dll')
    .lookupFunction<TransformPattern_MoveNative, TransformPattern_MoveDart>('TransformPattern_Move');
// hobj : HUIAPATTERNOBJECT -> Pointer<Void>
// x : DOUBLE -> Double
// y : DOUBLE -> Double
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function TransformPattern_Move(
  hobj: THandle;   // HUIAPATTERNOBJECT
  x: Double;   // DOUBLE
  y: Double   // DOUBLE
): Integer; stdcall;
  external 'UIAutomationCore.dll' name 'TransformPattern_Move';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "TransformPattern_Move"
  c_TransformPattern_Move :: Ptr () -> CDouble -> CDouble -> IO Int32
-- hobj : HUIAPATTERNOBJECT -> Ptr ()
-- x : DOUBLE -> CDouble
-- y : DOUBLE -> CDouble
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let transformpattern_move =
  foreign "TransformPattern_Move"
    ((ptr void) @-> double @-> double @-> returning int32_t)
(* hobj : HUIAPATTERNOBJECT -> (ptr void) *)
(* x : DOUBLE -> double *)
(* y : DOUBLE -> double *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library uiautomationcore (t "UIAutomationCore.dll"))
(cffi:use-foreign-library uiautomationcore)

(cffi:defcfun ("TransformPattern_Move" transform-pattern-move :convention :stdcall) :int32
  (hobj :pointer)   ; HUIAPATTERNOBJECT
  (x :double)   ; DOUBLE
  (y :double))   ; DOUBLE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $TransformPattern_Move = Win32::API::More->new('UIAutomationCore',
    'int TransformPattern_Move(HANDLE hobj, double x, double y)');
# my $ret = $TransformPattern_Move->Call($hobj, $x, $y);
# hobj : HUIAPATTERNOBJECT -> HANDLE
# x : DOUBLE -> double
# y : DOUBLE -> double
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。