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

UiaRect

構造体
サイズx64: 32 バイト / x86: 32 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
leftDOUBLE8+0+0矩形の左端のX座標。
topDOUBLE8+8+8矩形の上端のY座標。
widthDOUBLE8+16+16矩形の幅。
heightDOUBLE8+24+24矩形の高さ。

各言語での定義

#include <windows.h>

// UiaRect  (x64 32 / x86 32 バイト)
typedef struct UiaRect {
    DOUBLE left;
    DOUBLE top;
    DOUBLE width;
    DOUBLE height;
} UiaRect;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UiaRect
{
    public double left;
    public double top;
    public double width;
    public double height;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UiaRect
    Public left As Double
    Public top As Double
    Public width As Double
    Public height As Double
End Structure
import ctypes
from ctypes import wintypes

class UiaRect(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_double),
        ("top", ctypes.c_double),
        ("width", ctypes.c_double),
        ("height", ctypes.c_double),
    ]
#[repr(C)]
pub struct UiaRect {
    pub left: f64,
    pub top: f64,
    pub width: f64,
    pub height: f64,
}
import "golang.org/x/sys/windows"

type UiaRect struct {
	left float64
	top float64
	width float64
	height float64
}
type
  UiaRect = record
    left: Double;
    top: Double;
    width: Double;
    height: Double;
  end;
const UiaRect = extern struct {
    left: f64,
    top: f64,
    width: f64,
    height: f64,
};
type
  UiaRect {.bycopy.} = object
    left: float64
    top: float64
    width: float64
    height: float64
struct UiaRect
{
    double left;
    double top;
    double width;
    double height;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; UiaRect サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; left : DOUBLE (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; top : DOUBLE (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; width : DOUBLE (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; height : DOUBLE (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global UiaRect
    #field double left
    #field double top
    #field double width
    #field double height
#endstruct

stdim st, UiaRect        ; NSTRUCT 変数を確保
st->left = 100
mes "left=" + st->left