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

MilRectD

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

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

フィールド

フィールドサイズx64x86説明
leftDOUBLE8+0+0矩形の左端の座標(倍精度)である。
topDOUBLE8+8+8矩形の上端の座標(倍精度)である。
rightDOUBLE8+16+16矩形の右端の座標(倍精度)である。
bottomDOUBLE8+24+24矩形の下端の座標(倍精度)である。

各言語での定義

#include <windows.h>

// MilRectD  (x64 32 / x86 32 バイト)
typedef struct MilRectD {
    DOUBLE left;
    DOUBLE top;
    DOUBLE right;
    DOUBLE bottom;
} MilRectD;
using System;
using System.Runtime.InteropServices;

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

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

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

type MilRectD struct {
	left float64
	top float64
	right float64
	bottom float64
}
type
  MilRectD = record
    left: Double;
    top: Double;
    right: Double;
    bottom: Double;
  end;
const MilRectD = extern struct {
    left: f64,
    top: f64,
    right: f64,
    bottom: f64,
};
type
  MilRectD {.bycopy.} = object
    left: float64
    top: float64
    right: float64
    bottom: float64
struct MilRectD
{
    double left;
    double top;
    double right;
    double bottom;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MilRectD サイズ: 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,上位
; right : DOUBLE (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; bottom : 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 MilRectD
    #field double left
    #field double top
    #field double right
    #field double bottom
#endstruct

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