Win32 API 日本語リファレンス
ホームGraphics.Gdi › RGNDATA

RGNDATA

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

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

フィールド

フィールドサイズx64x86説明
rdhRGNDATAHEADER32+0+0リージョンデータのヘッダ情報を表すRGNDATAHEADER構造体。
BufferCHAR1+32+32リージョンを構成するRECT矩形配列を格納する可変長バッファの先頭。

各言語での定義

#include <windows.h>

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

// RGNDATAHEADER  (x64 32 / x86 32 バイト)
typedef struct RGNDATAHEADER {
    DWORD dwSize;
    DWORD iType;
    DWORD nCount;
    DWORD nRgnSize;
    RECT rcBound;
} RGNDATAHEADER;

// RGNDATA  (x64 36 / x86 36 バイト)
typedef struct RGNDATA {
    RGNDATAHEADER rdh;
    CHAR Buffer[1];
} RGNDATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RGNDATAHEADER
{
    public uint dwSize;
    public uint iType;
    public uint nCount;
    public uint nRgnSize;
    public RECT rcBound;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RGNDATA
{
    public RGNDATAHEADER rdh;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public sbyte[] Buffer;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RGNDATAHEADER
    Public dwSize As UInteger
    Public iType As UInteger
    Public nCount As UInteger
    Public nRgnSize As UInteger
    Public rcBound As RECT
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RGNDATA
    Public rdh As RGNDATAHEADER
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Buffer() As SByte
End Structure
import ctypes
from ctypes import wintypes

class RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class RGNDATAHEADER(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("iType", wintypes.DWORD),
        ("nCount", wintypes.DWORD),
        ("nRgnSize", wintypes.DWORD),
        ("rcBound", RECT),
    ]

class RGNDATA(ctypes.Structure):
    _fields_ = [
        ("rdh", RGNDATAHEADER),
        ("Buffer", ctypes.c_byte * 1),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct RGNDATAHEADER {
    pub dwSize: u32,
    pub iType: u32,
    pub nCount: u32,
    pub nRgnSize: u32,
    pub rcBound: RECT,
}

#[repr(C)]
pub struct RGNDATA {
    pub rdh: RGNDATAHEADER,
    pub Buffer: [i8; 1],
}
import "golang.org/x/sys/windows"

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type RGNDATAHEADER struct {
	dwSize uint32
	iType uint32
	nCount uint32
	nRgnSize uint32
	rcBound RECT
}

type RGNDATA struct {
	rdh RGNDATAHEADER
	Buffer [1]int8
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  RGNDATAHEADER = record
    dwSize: DWORD;
    iType: DWORD;
    nCount: DWORD;
    nRgnSize: DWORD;
    rcBound: RECT;
  end;

  RGNDATA = record
    rdh: RGNDATAHEADER;
    Buffer: array[0..0] of Shortint;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const RGNDATAHEADER = extern struct {
    dwSize: u32,
    iType: u32,
    nCount: u32,
    nRgnSize: u32,
    rcBound: RECT,
};

const RGNDATA = extern struct {
    rdh: RGNDATAHEADER,
    Buffer: [1]i8,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  RGNDATAHEADER {.bycopy.} = object
    dwSize: uint32
    iType: uint32
    nCount: uint32
    nRgnSize: uint32
    rcBound: RECT

  RGNDATA {.bycopy.} = object
    rdh: RGNDATAHEADER
    Buffer: array[1, int8]
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct RGNDATAHEADER
{
    uint dwSize;
    uint iType;
    uint nCount;
    uint nRgnSize;
    RECT rcBound;
}

struct RGNDATA
{
    RGNDATAHEADER rdh;
    byte[1] Buffer;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; RGNDATA サイズ: 36 バイト(x64)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; rdh : RGNDATAHEADER (+0, 32byte)  varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; Buffer : CHAR (+32, 1byte)  varptr(st)+32 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global RGNDATAHEADER
    #field int dwSize
    #field int iType
    #field int nCount
    #field int nRgnSize
    #field RECT rcBound
#endstruct

#defstruct global RGNDATA
    #field RGNDATAHEADER rdh
    #field byte Buffer 1
#endstruct

stdim st, RGNDATA        ; NSTRUCT 変数を確保