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

DDMONITORINFO

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

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

フィールド

フィールドサイズx64x86説明
ManufacturerWORD2+0+0モニタ製造元コード(EDIDベンダ)を示す。
ProductWORD2+2+2モニタ製品コードを示す。
SerialNumberDWORD4+4+4モニタのシリアル番号を示す。
DeviceIdentifierGUID16+8+8モニタを識別するGUID。
Mode640x480INT4+24+24640x480モードの対応状況/リフレッシュ情報を示す。
Mode800x600INT4+28+28800x600モードの対応状況/リフレッシュ情報を示す。
Mode1024x768INT4+32+321024x768モードの対応状況/リフレッシュ情報を示す。
Mode1280x1024INT4+36+361280x1024モードの対応状況/リフレッシュ情報を示す。
Mode1600x1200INT4+40+401600x1200モードの対応状況/リフレッシュ情報を示す。
ModeReserved1INT4+44+44予約モードフィールド(その1)。
ModeReserved2INT4+48+48予約モードフィールド(その2)。
ModeReserved3INT4+52+52予約モードフィールド(その3)。

各言語での定義

#include <windows.h>

// DDMONITORINFO  (x64 56 / x86 56 バイト)
typedef struct DDMONITORINFO {
    WORD Manufacturer;
    WORD Product;
    DWORD SerialNumber;
    GUID DeviceIdentifier;
    INT Mode640x480;
    INT Mode800x600;
    INT Mode1024x768;
    INT Mode1280x1024;
    INT Mode1600x1200;
    INT ModeReserved1;
    INT ModeReserved2;
    INT ModeReserved3;
} DDMONITORINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDMONITORINFO
{
    public ushort Manufacturer;
    public ushort Product;
    public uint SerialNumber;
    public Guid DeviceIdentifier;
    public int Mode640x480;
    public int Mode800x600;
    public int Mode1024x768;
    public int Mode1280x1024;
    public int Mode1600x1200;
    public int ModeReserved1;
    public int ModeReserved2;
    public int ModeReserved3;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDMONITORINFO
    Public Manufacturer As UShort
    Public Product As UShort
    Public SerialNumber As UInteger
    Public DeviceIdentifier As Guid
    Public Mode640x480 As Integer
    Public Mode800x600 As Integer
    Public Mode1024x768 As Integer
    Public Mode1280x1024 As Integer
    Public Mode1600x1200 As Integer
    Public ModeReserved1 As Integer
    Public ModeReserved2 As Integer
    Public ModeReserved3 As Integer
End Structure
import ctypes
from ctypes import wintypes

class DDMONITORINFO(ctypes.Structure):
    _fields_ = [
        ("Manufacturer", ctypes.c_ushort),
        ("Product", ctypes.c_ushort),
        ("SerialNumber", wintypes.DWORD),
        ("DeviceIdentifier", GUID),
        ("Mode640x480", ctypes.c_int),
        ("Mode800x600", ctypes.c_int),
        ("Mode1024x768", ctypes.c_int),
        ("Mode1280x1024", ctypes.c_int),
        ("Mode1600x1200", ctypes.c_int),
        ("ModeReserved1", ctypes.c_int),
        ("ModeReserved2", ctypes.c_int),
        ("ModeReserved3", ctypes.c_int),
    ]
#[repr(C)]
pub struct DDMONITORINFO {
    pub Manufacturer: u16,
    pub Product: u16,
    pub SerialNumber: u32,
    pub DeviceIdentifier: GUID,
    pub Mode640x480: i32,
    pub Mode800x600: i32,
    pub Mode1024x768: i32,
    pub Mode1280x1024: i32,
    pub Mode1600x1200: i32,
    pub ModeReserved1: i32,
    pub ModeReserved2: i32,
    pub ModeReserved3: i32,
}
import "golang.org/x/sys/windows"

type DDMONITORINFO struct {
	Manufacturer uint16
	Product uint16
	SerialNumber uint32
	DeviceIdentifier windows.GUID
	Mode640x480 int32
	Mode800x600 int32
	Mode1024x768 int32
	Mode1280x1024 int32
	Mode1600x1200 int32
	ModeReserved1 int32
	ModeReserved2 int32
	ModeReserved3 int32
}
type
  DDMONITORINFO = record
    Manufacturer: Word;
    Product: Word;
    SerialNumber: DWORD;
    DeviceIdentifier: TGUID;
    Mode640x480: Integer;
    Mode800x600: Integer;
    Mode1024x768: Integer;
    Mode1280x1024: Integer;
    Mode1600x1200: Integer;
    ModeReserved1: Integer;
    ModeReserved2: Integer;
    ModeReserved3: Integer;
  end;
const DDMONITORINFO = extern struct {
    Manufacturer: u16,
    Product: u16,
    SerialNumber: u32,
    DeviceIdentifier: GUID,
    Mode640x480: i32,
    Mode800x600: i32,
    Mode1024x768: i32,
    Mode1280x1024: i32,
    Mode1600x1200: i32,
    ModeReserved1: i32,
    ModeReserved2: i32,
    ModeReserved3: i32,
};
type
  DDMONITORINFO {.bycopy.} = object
    Manufacturer: uint16
    Product: uint16
    SerialNumber: uint32
    DeviceIdentifier: GUID
    Mode640x480: int32
    Mode800x600: int32
    Mode1024x768: int32
    Mode1280x1024: int32
    Mode1600x1200: int32
    ModeReserved1: int32
    ModeReserved2: int32
    ModeReserved3: int32
struct DDMONITORINFO
{
    ushort Manufacturer;
    ushort Product;
    uint SerialNumber;
    GUID DeviceIdentifier;
    int Mode640x480;
    int Mode800x600;
    int Mode1024x768;
    int Mode1280x1024;
    int Mode1600x1200;
    int ModeReserved1;
    int ModeReserved2;
    int ModeReserved3;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDMONITORINFO サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; Manufacturer : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Product : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; SerialNumber : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; DeviceIdentifier : GUID (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; Mode640x480 : INT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Mode800x600 : INT (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; Mode1024x768 : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; Mode1280x1024 : INT (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; Mode1600x1200 : INT (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ModeReserved1 : INT (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ModeReserved2 : INT (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ModeReserved3 : INT (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global DDMONITORINFO
    #field short Manufacturer
    #field short Product
    #field int SerialNumber
    #field GUID DeviceIdentifier
    #field int Mode640x480
    #field int Mode800x600
    #field int Mode1024x768
    #field int Mode1280x1024
    #field int Mode1600x1200
    #field int ModeReserved1
    #field int ModeReserved2
    #field int ModeReserved3
#endstruct

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