Win32 API 日本語リファレンス
ホームSystem.RemoteDesktop › RFX_GFX_MONITOR_INFO

RFX_GFX_MONITOR_INFO

構造体
サイズx64: 32 バイト / x86: 32 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
leftINT4+0+0モニタ矩形の左端のX座標。ピクセル単位。
topINT4+4+4モニタ矩形の上端のY座標。ピクセル単位。
rightINT4+8+8モニタ矩形の右端のX座標。ピクセル単位。
bottomINT4+12+12モニタ矩形の下端のY座標。ピクセル単位。
physicalWidthDWORD4+16+16モニタの物理的な幅。ミリメートル単位で表す。
physicalHeightDWORD4+20+20モニタの物理的な高さ。ミリメートル単位で表す。
orientationDWORD4+24+24モニタの向き(回転角度)を示す値。
primaryBOOL4+28+28プライマリモニタかどうかを示すブール値。

各言語での定義

#include <windows.h>

// RFX_GFX_MONITOR_INFO  (x64 32 / x86 32 バイト)
#pragma pack(push, 1)
typedef struct RFX_GFX_MONITOR_INFO {
    INT left;
    INT top;
    INT right;
    INT bottom;
    DWORD physicalWidth;
    DWORD physicalHeight;
    DWORD orientation;
    BOOL primary;
} RFX_GFX_MONITOR_INFO;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct RFX_GFX_MONITOR_INFO
{
    public int left;
    public int top;
    public int right;
    public int bottom;
    public uint physicalWidth;
    public uint physicalHeight;
    public uint orientation;
    [MarshalAs(UnmanagedType.Bool)] public bool primary;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure RFX_GFX_MONITOR_INFO
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
    Public physicalWidth As UInteger
    Public physicalHeight As UInteger
    Public orientation As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public primary As Boolean
End Structure
import ctypes
from ctypes import wintypes

class RFX_GFX_MONITOR_INFO(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
        ("physicalWidth", wintypes.DWORD),
        ("physicalHeight", wintypes.DWORD),
        ("orientation", wintypes.DWORD),
        ("primary", wintypes.BOOL),
    ]
#[repr(C, packed(1))]
pub struct RFX_GFX_MONITOR_INFO {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
    pub physicalWidth: u32,
    pub physicalHeight: u32,
    pub orientation: u32,
    pub primary: i32,
}
import "golang.org/x/sys/windows"

type RFX_GFX_MONITOR_INFO struct {
	left int32
	top int32
	right int32
	bottom int32
	physicalWidth uint32
	physicalHeight uint32
	orientation uint32
	primary int32
}
type
  RFX_GFX_MONITOR_INFO = packed record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
    physicalWidth: DWORD;
    physicalHeight: DWORD;
    orientation: DWORD;
    primary: BOOL;
  end;
const RFX_GFX_MONITOR_INFO = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
    physicalWidth: u32,
    physicalHeight: u32,
    orientation: u32,
    primary: i32,
};
type
  RFX_GFX_MONITOR_INFO {.packed.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32
    physicalWidth: uint32
    physicalHeight: uint32
    orientation: uint32
    primary: int32
align(1)
struct RFX_GFX_MONITOR_INFO
{
    int left;
    int top;
    int right;
    int bottom;
    uint physicalWidth;
    uint physicalHeight;
    uint orientation;
    int primary;
}

HSP用 定義

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

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

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