ホーム › UI.WindowsAndMessaging › WINDOW_ACTION
WINDOW_ACTION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| kinds | WINDOW_ACTION_KINDS | 4 | +0 | +0 | 実行するウィンドウ操作の種類を示すフラグである。 |
| modifiers | WINDOW_ACTION_MODIFIERS | 4 | +4 | +4 | ウィンドウ操作に適用する修飾子である。 |
| visible | BOOL | 4 | +8 | +8 | ウィンドウの表示状態を指定する。 |
| position | POINT | 8 | +12 | +12 | ウィンドウの位置(POINT)を指定する。 |
| size | SIZE | 8 | +20 | +20 | ウィンドウのサイズ(SIZE)を指定する。 |
| insertAfter | HWND | 8/4 | +32 | +28 | Z オーダー上でこのウィンドウの直前に配置するウィンドウのハンドルである。 |
| placementState | WINDOW_PLACEMENT_STATE | 4 | +40 | +32 | ウィンドウの配置状態(通常、最小化、最大化など)である。 |
| normalRect | RECT | 16 | +44 | +36 | 通常(復元)状態でのウィンドウの矩形である。 |
| workArea | RECT | 16 | +60 | +52 | 対象モニターの作業領域の矩形である。 |
| dpi | DWORD | 4 | +76 | +68 | 対象モニターの DPI 値である。 |
| pointOnMonitor | POINT | 8 | +80 | +72 | モニター上の基準点(POINT)である。 |
| monitorTopologyId | DWORD | 4 | +88 | +80 | モニタートポロジの識別子である。 |
各言語での定義
#include <windows.h>
// POINT (x64 8 / x86 8 バイト)
typedef struct POINT {
INT x;
INT y;
} POINT;
// SIZE (x64 8 / x86 8 バイト)
typedef struct SIZE {
INT cx;
INT cy;
} SIZE;
// RECT (x64 16 / x86 16 バイト)
typedef struct RECT {
INT left;
INT top;
INT right;
INT bottom;
} RECT;
// WINDOW_ACTION (x64 96 / x86 84 バイト)
typedef struct WINDOW_ACTION {
WINDOW_ACTION_KINDS kinds;
WINDOW_ACTION_MODIFIERS modifiers;
BOOL visible;
POINT position;
SIZE size;
HWND insertAfter;
WINDOW_PLACEMENT_STATE placementState;
RECT normalRect;
RECT workArea;
DWORD dpi;
POINT pointOnMonitor;
DWORD monitorTopologyId;
} WINDOW_ACTION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINT
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIZE
{
public int cx;
public int cy;
}
[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 WINDOW_ACTION
{
public int kinds;
public int modifiers;
[MarshalAs(UnmanagedType.Bool)] public bool visible;
public POINT position;
public SIZE size;
public IntPtr insertAfter;
public int placementState;
public RECT normalRect;
public RECT workArea;
public uint dpi;
public POINT pointOnMonitor;
public uint monitorTopologyId;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINT
Public x As Integer
Public y As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIZE
Public cx As Integer
Public cy As Integer
End Structure
<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 WINDOW_ACTION
Public kinds As Integer
Public modifiers As Integer
<MarshalAs(UnmanagedType.Bool)> Public visible As Boolean
Public position As POINT
Public size As SIZE
Public insertAfter As IntPtr
Public placementState As Integer
Public normalRect As RECT
Public workArea As RECT
Public dpi As UInteger
Public pointOnMonitor As POINT
Public monitorTopologyId As UInteger
End Structureimport ctypes
from ctypes import wintypes
class POINT(ctypes.Structure):
_fields_ = [
("x", ctypes.c_int),
("y", ctypes.c_int),
]
class SIZE(ctypes.Structure):
_fields_ = [
("cx", ctypes.c_int),
("cy", ctypes.c_int),
]
class RECT(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class WINDOW_ACTION(ctypes.Structure):
_fields_ = [
("kinds", ctypes.c_int),
("modifiers", ctypes.c_int),
("visible", wintypes.BOOL),
("position", POINT),
("size", SIZE),
("insertAfter", ctypes.c_void_p),
("placementState", ctypes.c_int),
("normalRect", RECT),
("workArea", RECT),
("dpi", wintypes.DWORD),
("pointOnMonitor", POINT),
("monitorTopologyId", wintypes.DWORD),
]#[repr(C)]
pub struct POINT {
pub x: i32,
pub y: i32,
}
#[repr(C)]
pub struct SIZE {
pub cx: i32,
pub cy: i32,
}
#[repr(C)]
pub struct RECT {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct WINDOW_ACTION {
pub kinds: i32,
pub modifiers: i32,
pub visible: i32,
pub position: POINT,
pub size: SIZE,
pub insertAfter: *mut core::ffi::c_void,
pub placementState: i32,
pub normalRect: RECT,
pub workArea: RECT,
pub dpi: u32,
pub pointOnMonitor: POINT,
pub monitorTopologyId: u32,
}import "golang.org/x/sys/windows"
type POINT struct {
x int32
y int32
}
type SIZE struct {
cx int32
cy int32
}
type RECT struct {
left int32
top int32
right int32
bottom int32
}
type WINDOW_ACTION struct {
kinds int32
modifiers int32
visible int32
position POINT
size SIZE
insertAfter uintptr
placementState int32
normalRect RECT
workArea RECT
dpi uint32
pointOnMonitor POINT
monitorTopologyId uint32
}type
POINT = record
x: Integer;
y: Integer;
end;
SIZE = record
cx: Integer;
cy: Integer;
end;
RECT = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
WINDOW_ACTION = record
kinds: Integer;
modifiers: Integer;
visible: BOOL;
position: POINT;
size: SIZE;
insertAfter: Pointer;
placementState: Integer;
normalRect: RECT;
workArea: RECT;
dpi: DWORD;
pointOnMonitor: POINT;
monitorTopologyId: DWORD;
end;const POINT = extern struct {
x: i32,
y: i32,
};
const SIZE = extern struct {
cx: i32,
cy: i32,
};
const RECT = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const WINDOW_ACTION = extern struct {
kinds: i32,
modifiers: i32,
visible: i32,
position: POINT,
size: SIZE,
insertAfter: ?*anyopaque,
placementState: i32,
normalRect: RECT,
workArea: RECT,
dpi: u32,
pointOnMonitor: POINT,
monitorTopologyId: u32,
};type
POINT {.bycopy.} = object
x: int32
y: int32
SIZE {.bycopy.} = object
cx: int32
cy: int32
RECT {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
WINDOW_ACTION {.bycopy.} = object
kinds: int32
modifiers: int32
visible: int32
position: POINT
size: SIZE
insertAfter: pointer
placementState: int32
normalRect: RECT
workArea: RECT
dpi: uint32
pointOnMonitor: POINT
monitorTopologyId: uint32struct POINT
{
int x;
int y;
}
struct SIZE
{
int cx;
int cy;
}
struct RECT
{
int left;
int top;
int right;
int bottom;
}
struct WINDOW_ACTION
{
int kinds;
int modifiers;
int visible;
POINT position;
SIZE size;
void* insertAfter;
int placementState;
RECT normalRect;
RECT workArea;
uint dpi;
POINT pointOnMonitor;
uint monitorTopologyId;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WINDOW_ACTION サイズ: 84 バイト(x86)
dim st, 21 ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; kinds : WINDOW_ACTION_KINDS (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; modifiers : WINDOW_ACTION_MODIFIERS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; visible : BOOL (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; position : POINT (+12, 8byte) varptr(st)+12 を基点に操作(8byte:入れ子/配列)
; size : SIZE (+20, 8byte) varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; insertAfter : HWND (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; placementState : WINDOW_PLACEMENT_STATE (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; normalRect : RECT (+36, 16byte) varptr(st)+36 を基点に操作(16byte:入れ子/配列)
; workArea : RECT (+52, 16byte) varptr(st)+52 を基点に操作(16byte:入れ子/配列)
; dpi : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; pointOnMonitor : POINT (+72, 8byte) varptr(st)+72 を基点に操作(8byte:入れ子/配列)
; monitorTopologyId : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WINDOW_ACTION サイズ: 96 バイト(x64)
dim st, 24 ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; kinds : WINDOW_ACTION_KINDS (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; modifiers : WINDOW_ACTION_MODIFIERS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; visible : BOOL (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; position : POINT (+12, 8byte) varptr(st)+12 を基点に操作(8byte:入れ子/配列)
; size : SIZE (+20, 8byte) varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; insertAfter : HWND (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; placementState : WINDOW_PLACEMENT_STATE (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; normalRect : RECT (+44, 16byte) varptr(st)+44 を基点に操作(16byte:入れ子/配列)
; workArea : RECT (+60, 16byte) varptr(st)+60 を基点に操作(16byte:入れ子/配列)
; dpi : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; pointOnMonitor : POINT (+80, 8byte) varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; monitorTopologyId : DWORD (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global POINT
#field int x
#field int y
#endstruct
#defstruct global SIZE
#field int cx
#field int cy
#endstruct
#defstruct global RECT
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global WINDOW_ACTION
#field int kinds
#field int modifiers
#field bool visible
#field POINT position
#field SIZE size
#field intptr insertAfter
#field int placementState
#field RECT normalRect
#field RECT workArea
#field int dpi
#field POINT pointOnMonitor
#field int monitorTopologyId
#endstruct
stdim st, WINDOW_ACTION ; NSTRUCT 変数を確保
st->kinds = 100
mes "kinds=" + st->kinds