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

WNDOBJ

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

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

フィールド

フィールドサイズx64x86説明
coClientCLIPOBJ24+0+0クライアント領域のクリップ情報(CLIPOBJ)。
pvConsumervoid*8/4+24+24コンシューマが自由に利用できるポインタ。
rclClientRECTL16+32+28クライアント領域の矩形(RECTL)。
psoOwnerSURFOBJ*8/4+48+44このウィンドウを所有するサーフェス(SURFOBJ)へのポインタ。

各言語での定義

#include <windows.h>

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

// CLIPOBJ  (x64 24 / x86 24 バイト)
typedef struct CLIPOBJ {
    DWORD iUniq;
    RECTL rclBounds;
    BYTE iDComplexity;
    BYTE iFComplexity;
    BYTE iMode;
    BYTE fjOptions;
} CLIPOBJ;

// WNDOBJ  (x64 56 / x86 48 バイト)
typedef struct WNDOBJ {
    CLIPOBJ coClient;
    void* pvConsumer;
    RECTL rclClient;
    SURFOBJ* psoOwner;
} WNDOBJ;
using System;
using System.Runtime.InteropServices;

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLIPOBJ
{
    public uint iUniq;
    public RECTL rclBounds;
    public byte iDComplexity;
    public byte iFComplexity;
    public byte iMode;
    public byte fjOptions;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WNDOBJ
{
    public CLIPOBJ coClient;
    public IntPtr pvConsumer;
    public RECTL rclClient;
    public IntPtr psoOwner;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECTL
    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 CLIPOBJ
    Public iUniq As UInteger
    Public rclBounds As RECTL
    Public iDComplexity As Byte
    Public iFComplexity As Byte
    Public iMode As Byte
    Public fjOptions As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WNDOBJ
    Public coClient As CLIPOBJ
    Public pvConsumer As IntPtr
    Public rclClient As RECTL
    Public psoOwner As IntPtr
End Structure
import ctypes
from ctypes import wintypes

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

class CLIPOBJ(ctypes.Structure):
    _fields_ = [
        ("iUniq", wintypes.DWORD),
        ("rclBounds", RECTL),
        ("iDComplexity", ctypes.c_ubyte),
        ("iFComplexity", ctypes.c_ubyte),
        ("iMode", ctypes.c_ubyte),
        ("fjOptions", ctypes.c_ubyte),
    ]

class WNDOBJ(ctypes.Structure):
    _fields_ = [
        ("coClient", CLIPOBJ),
        ("pvConsumer", ctypes.c_void_p),
        ("rclClient", RECTL),
        ("psoOwner", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct RECTL {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct CLIPOBJ {
    pub iUniq: u32,
    pub rclBounds: RECTL,
    pub iDComplexity: u8,
    pub iFComplexity: u8,
    pub iMode: u8,
    pub fjOptions: u8,
}

#[repr(C)]
pub struct WNDOBJ {
    pub coClient: CLIPOBJ,
    pub pvConsumer: *mut core::ffi::c_void,
    pub rclClient: RECTL,
    pub psoOwner: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

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

type CLIPOBJ struct {
	iUniq uint32
	rclBounds RECTL
	iDComplexity byte
	iFComplexity byte
	iMode byte
	fjOptions byte
}

type WNDOBJ struct {
	coClient CLIPOBJ
	pvConsumer uintptr
	rclClient RECTL
	psoOwner uintptr
}
type
  RECTL = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  CLIPOBJ = record
    iUniq: DWORD;
    rclBounds: RECTL;
    iDComplexity: Byte;
    iFComplexity: Byte;
    iMode: Byte;
    fjOptions: Byte;
  end;

  WNDOBJ = record
    coClient: CLIPOBJ;
    pvConsumer: Pointer;
    rclClient: RECTL;
    psoOwner: Pointer;
  end;
const RECTL = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const CLIPOBJ = extern struct {
    iUniq: u32,
    rclBounds: RECTL,
    iDComplexity: u8,
    iFComplexity: u8,
    iMode: u8,
    fjOptions: u8,
};

const WNDOBJ = extern struct {
    coClient: CLIPOBJ,
    pvConsumer: ?*anyopaque,
    rclClient: RECTL,
    psoOwner: ?*anyopaque,
};
type
  RECTL {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  CLIPOBJ {.bycopy.} = object
    iUniq: uint32
    rclBounds: RECTL
    iDComplexity: uint8
    iFComplexity: uint8
    iMode: uint8
    fjOptions: uint8

  WNDOBJ {.bycopy.} = object
    coClient: CLIPOBJ
    pvConsumer: pointer
    rclClient: RECTL
    psoOwner: pointer
struct RECTL
{
    int left;
    int top;
    int right;
    int bottom;
}

struct CLIPOBJ
{
    uint iUniq;
    RECTL rclBounds;
    ubyte iDComplexity;
    ubyte iFComplexity;
    ubyte iMode;
    ubyte fjOptions;
}

struct WNDOBJ
{
    CLIPOBJ coClient;
    void* pvConsumer;
    RECTL rclClient;
    void* psoOwner;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WNDOBJ サイズ: 48 バイト(x86)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; coClient : CLIPOBJ (+0, 24byte)  varptr(st)+0 を基点に操作(24byte:入れ子/配列)
; pvConsumer : void* (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; rclClient : RECTL (+28, 16byte)  varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; psoOwner : SURFOBJ* (+44, 4byte)  varptr(st)+44 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WNDOBJ サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; coClient : CLIPOBJ (+0, 24byte)  varptr(st)+0 を基点に操作(24byte:入れ子/配列)
; pvConsumer : void* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; rclClient : RECTL (+32, 16byte)  varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; psoOwner : SURFOBJ* (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECTL
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global CLIPOBJ
    #field int iUniq
    #field RECTL rclBounds
    #field byte iDComplexity
    #field byte iFComplexity
    #field byte iMode
    #field byte fjOptions
#endstruct

#defstruct global WNDOBJ
    #field CLIPOBJ coClient
    #field intptr pvConsumer
    #field RECTL rclClient
    #field intptr psoOwner
#endstruct

stdim st, WNDOBJ        ; NSTRUCT 変数を確保