Win32 API 日本語リファレンス
ホームDevices.Display › RECTFX

RECTFX

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

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

フィールド

フィールドサイズx64x86説明
xLeftINT4+0+0矩形の左辺X座標(固定小数点)。
yTopINT4+4+4矩形の上辺Y座標(固定小数点)。
xRightINT4+8+8矩形の右辺X座標(固定小数点)。
yBottomINT4+12+12矩形の下辺Y座標(固定小数点)。

各言語での定義

#include <windows.h>

// RECTFX  (x64 16 / x86 16 バイト)
typedef struct RECTFX {
    INT xLeft;
    INT yTop;
    INT xRight;
    INT yBottom;
} RECTFX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECTFX
{
    public int xLeft;
    public int yTop;
    public int xRight;
    public int yBottom;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECTFX
    Public xLeft As Integer
    Public yTop As Integer
    Public xRight As Integer
    Public yBottom As Integer
End Structure
import ctypes
from ctypes import wintypes

class RECTFX(ctypes.Structure):
    _fields_ = [
        ("xLeft", ctypes.c_int),
        ("yTop", ctypes.c_int),
        ("xRight", ctypes.c_int),
        ("yBottom", ctypes.c_int),
    ]
#[repr(C)]
pub struct RECTFX {
    pub xLeft: i32,
    pub yTop: i32,
    pub xRight: i32,
    pub yBottom: i32,
}
import "golang.org/x/sys/windows"

type RECTFX struct {
	xLeft int32
	yTop int32
	xRight int32
	yBottom int32
}
type
  RECTFX = record
    xLeft: Integer;
    yTop: Integer;
    xRight: Integer;
    yBottom: Integer;
  end;
const RECTFX = extern struct {
    xLeft: i32,
    yTop: i32,
    xRight: i32,
    yBottom: i32,
};
type
  RECTFX {.bycopy.} = object
    xLeft: int32
    yTop: int32
    xRight: int32
    yBottom: int32
struct RECTFX
{
    int xLeft;
    int yTop;
    int xRight;
    int yBottom;
}

HSP用 定義

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

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

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