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

TransformPattern_Resize

関数
Transformパターンで要素を指定サイズに変更する。
DLLUIAutomationCore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT TransformPattern_Resize(
    HUIAPATTERNOBJECT hobj,
    DOUBLE width,
    DOUBLE height
);

パラメーター

名前方向説明
hobjHUIAPATTERNOBJECTinTransformPatternを表すパターンオブジェクトハンドル。
widthDOUBLEin変更後の幅(倍精度)。
heightDOUBLEin変更後の高さ(倍精度)。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

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

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

var (
	uiautomationcore = windows.NewLazySystemDLL("UIAutomationCore.dll")
	procTransformPattern_Resize = uiautomationcore.NewProc("TransformPattern_Resize")
)

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

extern "uiautomationcore" fn TransformPattern_Resize(
    hobj: ?*anyopaque, // HUIAPATTERNOBJECT
    width: f64, // DOUBLE
    height: f64 // DOUBLE
) callconv(std.os.windows.WINAPI) i32;
proc TransformPattern_Resize(
    hobj: pointer,  # HUIAPATTERNOBJECT
    width: float64,  # DOUBLE
    height: float64  # DOUBLE
): int32 {.importc: "TransformPattern_Resize", stdcall, dynlib: "UIAutomationCore.dll".}
pragma(lib, "uiautomationcore");
extern(Windows)
int TransformPattern_Resize(
    void* hobj,   // HUIAPATTERNOBJECT
    double width,   // DOUBLE
    double height   // DOUBLE
);
ccall((:TransformPattern_Resize, "UIAutomationCore.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Float64, Float64),
      hobj, width, height)
# hobj : HUIAPATTERNOBJECT -> Ptr{Cvoid}
# width : DOUBLE -> Float64
# height : DOUBLE -> Float64
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t TransformPattern_Resize(
    void* hobj,
    double width,
    double height);
]]
local uiautomationcore = ffi.load("uiautomationcore")
-- uiautomationcore.TransformPattern_Resize(hobj, width, height)
-- hobj : HUIAPATTERNOBJECT
-- width : DOUBLE
-- height : DOUBLE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('UIAutomationCore.dll');
const TransformPattern_Resize = lib.func('__stdcall', 'TransformPattern_Resize', 'int32_t', ['void *', 'double', 'double']);
// TransformPattern_Resize(hobj, width, height)
// hobj : HUIAPATTERNOBJECT -> 'void *'
// width : DOUBLE -> 'double'
// height : DOUBLE -> 'double'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("UIAutomationCore.dll", {
  TransformPattern_Resize: { parameters: ["pointer", "f64", "f64"], result: "i32" },
});
// lib.symbols.TransformPattern_Resize(hobj, width, height)
// hobj : HUIAPATTERNOBJECT -> "pointer"
// width : DOUBLE -> "f64"
// height : DOUBLE -> "f64"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t TransformPattern_Resize(
    void* hobj,
    double width,
    double height);
C, "UIAutomationCore.dll");
// $ffi->TransformPattern_Resize(hobj, width, height);
// hobj : HUIAPATTERNOBJECT
// width : DOUBLE
// height : 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_Resize(
        Pointer hobj,   // HUIAPATTERNOBJECT
        double width,   // DOUBLE
        double height   // DOUBLE
    );
}
@[Link("uiautomationcore")]
lib LibUIAutomationCore
  fun TransformPattern_Resize = TransformPattern_Resize(
    hobj : Void*,   # HUIAPATTERNOBJECT
    width : Float64,   # DOUBLE
    height : 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_ResizeNative = Int32 Function(Pointer<Void>, Double, Double);
typedef TransformPattern_ResizeDart = int Function(Pointer<Void>, double, double);
final TransformPattern_Resize = DynamicLibrary.open('UIAutomationCore.dll')
    .lookupFunction<TransformPattern_ResizeNative, TransformPattern_ResizeDart>('TransformPattern_Resize');
// hobj : HUIAPATTERNOBJECT -> Pointer<Void>
// width : DOUBLE -> Double
// height : DOUBLE -> Double
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function TransformPattern_Resize(
  hobj: THandle;   // HUIAPATTERNOBJECT
  width: Double;   // DOUBLE
  height: Double   // DOUBLE
): Integer; stdcall;
  external 'UIAutomationCore.dll' name 'TransformPattern_Resize';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

let transformpattern_resize =
  foreign "TransformPattern_Resize"
    ((ptr void) @-> double @-> double @-> returning int32_t)
(* hobj : HUIAPATTERNOBJECT -> (ptr void) *)
(* width : DOUBLE -> double *)
(* height : 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_Resize" transform-pattern-resize :convention :stdcall) :int32
  (hobj :pointer)   ; HUIAPATTERNOBJECT
  (width :double)   ; DOUBLE
  (height :double))   ; DOUBLE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $TransformPattern_Resize = Win32::API::More->new('UIAutomationCore',
    'int TransformPattern_Resize(HANDLE hobj, double width, double height)');
# my $ret = $TransformPattern_Resize->Call($hobj, $width, $height);
# hobj : HUIAPATTERNOBJECT -> HANDLE
# width : DOUBLE -> double
# height : DOUBLE -> double
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。