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

VMEMR

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

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

フィールド

フィールドサイズx64x86説明
nextVMEMR*8/4+0+0矩形メモリリストの次ノードへのポインタ。
prevVMEMR*8/4+8+4矩形メモリリストの前ノードへのポインタ。
pUpVMEMR*8/4+16+8上方向に隣接するメモリ領域へのポインタ。
pDownVMEMR*8/4+24+12下方向に隣接するメモリ領域へのポインタ。
pLeftVMEMR*8/4+32+16左方向に隣接するメモリ領域へのポインタ。
pRightVMEMR*8/4+40+20右方向に隣接するメモリ領域へのポインタ。
ptrUINT_PTR8/4+48+24メモリブロック先頭のアドレス(オフセット)を示す。
sizeDWORD4+56+28メモリブロックのサイズ(バイト)を示す。
xDWORD4+60+32矩形領域の左上X座標を示す。
yDWORD4+64+36矩形領域の左上Y座標を示す。
cxDWORD4+68+40矩形領域の幅を示す。
cyDWORD4+72+44矩形領域の高さを示す。
flagsDWORD4+76+48矩形ブロックの状態を示すフラグを示す。
pBitsUINT_PTR8/4+80+52実ピクセルデータへのアドレス(オフセット)を示す。
bDiscardableBOOL4+88+56破棄可能なブロックかを示す真偽値。

各言語での定義

#include <windows.h>

// VMEMR  (x64 96 / x86 60 バイト)
typedef struct VMEMR {
    VMEMR* next;
    VMEMR* prev;
    VMEMR* pUp;
    VMEMR* pDown;
    VMEMR* pLeft;
    VMEMR* pRight;
    UINT_PTR ptr;
    DWORD size;
    DWORD x;
    DWORD y;
    DWORD cx;
    DWORD cy;
    DWORD flags;
    UINT_PTR pBits;
    BOOL bDiscardable;
} VMEMR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VMEMR
{
    public IntPtr next;
    public IntPtr prev;
    public IntPtr pUp;
    public IntPtr pDown;
    public IntPtr pLeft;
    public IntPtr pRight;
    public UIntPtr ptr;
    public uint size;
    public uint x;
    public uint y;
    public uint cx;
    public uint cy;
    public uint flags;
    public UIntPtr pBits;
    [MarshalAs(UnmanagedType.Bool)] public bool bDiscardable;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VMEMR
    Public next As IntPtr
    Public prev As IntPtr
    Public pUp As IntPtr
    Public pDown As IntPtr
    Public pLeft As IntPtr
    Public pRight As IntPtr
    Public ptr As UIntPtr
    Public size As UInteger
    Public x As UInteger
    Public y As UInteger
    Public cx As UInteger
    Public cy As UInteger
    Public flags As UInteger
    Public pBits As UIntPtr
    <MarshalAs(UnmanagedType.Bool)> Public bDiscardable As Boolean
End Structure
import ctypes
from ctypes import wintypes

class VMEMR(ctypes.Structure):
    _fields_ = [
        ("next", ctypes.c_void_p),
        ("prev", ctypes.c_void_p),
        ("pUp", ctypes.c_void_p),
        ("pDown", ctypes.c_void_p),
        ("pLeft", ctypes.c_void_p),
        ("pRight", ctypes.c_void_p),
        ("ptr", ctypes.c_size_t),
        ("size", wintypes.DWORD),
        ("x", wintypes.DWORD),
        ("y", wintypes.DWORD),
        ("cx", wintypes.DWORD),
        ("cy", wintypes.DWORD),
        ("flags", wintypes.DWORD),
        ("pBits", ctypes.c_size_t),
        ("bDiscardable", wintypes.BOOL),
    ]
#[repr(C)]
pub struct VMEMR {
    pub next: *mut core::ffi::c_void,
    pub prev: *mut core::ffi::c_void,
    pub pUp: *mut core::ffi::c_void,
    pub pDown: *mut core::ffi::c_void,
    pub pLeft: *mut core::ffi::c_void,
    pub pRight: *mut core::ffi::c_void,
    pub ptr: usize,
    pub size: u32,
    pub x: u32,
    pub y: u32,
    pub cx: u32,
    pub cy: u32,
    pub flags: u32,
    pub pBits: usize,
    pub bDiscardable: i32,
}
import "golang.org/x/sys/windows"

type VMEMR struct {
	next uintptr
	prev uintptr
	pUp uintptr
	pDown uintptr
	pLeft uintptr
	pRight uintptr
	ptr uintptr
	size uint32
	x uint32
	y uint32
	cx uint32
	cy uint32
	flags uint32
	pBits uintptr
	bDiscardable int32
}
type
  VMEMR = record
    next: Pointer;
    prev: Pointer;
    pUp: Pointer;
    pDown: Pointer;
    pLeft: Pointer;
    pRight: Pointer;
    ptr: NativeUInt;
    size: DWORD;
    x: DWORD;
    y: DWORD;
    cx: DWORD;
    cy: DWORD;
    flags: DWORD;
    pBits: NativeUInt;
    bDiscardable: BOOL;
  end;
const VMEMR = extern struct {
    next: ?*anyopaque,
    prev: ?*anyopaque,
    pUp: ?*anyopaque,
    pDown: ?*anyopaque,
    pLeft: ?*anyopaque,
    pRight: ?*anyopaque,
    ptr: usize,
    size: u32,
    x: u32,
    y: u32,
    cx: u32,
    cy: u32,
    flags: u32,
    pBits: usize,
    bDiscardable: i32,
};
type
  VMEMR {.bycopy.} = object
    next: pointer
    prev: pointer
    pUp: pointer
    pDown: pointer
    pLeft: pointer
    pRight: pointer
    ptr: uint
    size: uint32
    x: uint32
    y: uint32
    cx: uint32
    cy: uint32
    flags: uint32
    pBits: uint
    bDiscardable: int32
struct VMEMR
{
    void* next;
    void* prev;
    void* pUp;
    void* pDown;
    void* pLeft;
    void* pRight;
    size_t ptr;
    uint size;
    uint x;
    uint y;
    uint cx;
    uint cy;
    uint flags;
    size_t pBits;
    int bDiscardable;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VMEMR サイズ: 60 バイト(x86)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; next : VMEMR* (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; prev : VMEMR* (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; pUp : VMEMR* (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; pDown : VMEMR* (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; pLeft : VMEMR* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; pRight : VMEMR* (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; ptr : UINT_PTR (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; size : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; x : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; y : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; cx : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; cy : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; flags : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; pBits : UINT_PTR (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; bDiscardable : BOOL (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VMEMR サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; next : VMEMR* (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; prev : VMEMR* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; pUp : VMEMR* (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; pDown : VMEMR* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; pLeft : VMEMR* (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; pRight : VMEMR* (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; ptr : UINT_PTR (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; size : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; x : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; y : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; cx : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; cy : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; flags : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; pBits : UINT_PTR (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; bDiscardable : BOOL (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VMEMR
    #field intptr next
    #field intptr prev
    #field intptr pUp
    #field intptr pDown
    #field intptr pLeft
    #field intptr pRight
    #field intptr ptr
    #field int size
    #field int x
    #field int y
    #field int cx
    #field int cy
    #field int flags
    #field intptr pBits
    #field bool bDiscardable
#endstruct

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