ホーム › Devices.Display › DEVINFO
DEVINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| flGraphicsCaps | DWORD | 4 | +0 | +0 | グラフィックス機能を示すケイパビリティフラグ(GCAPS_*)。 |
| lfDefaultFont | LOGFONTW | 92 | +4 | +4 | 既定フォントのLOGFONTW記述。 |
| lfAnsiVarFont | LOGFONTW | 92 | +96 | +96 | ANSI可変ピッチフォントの記述。 |
| lfAnsiFixFont | LOGFONTW | 92 | +188 | +188 | ANSI固定ピッチフォントの記述。 |
| cFonts | DWORD | 4 | +280 | +280 | ドライバが提供するデバイスフォント数。 |
| iDitherFormat | DWORD | 4 | +284 | +284 | ディザリングに使うサーフェス形式(BMF_*)。 |
| cxDither | WORD | 2 | +288 | +288 | ディザリングパターンの幅(ピクセル)。 |
| cyDither | WORD | 2 | +290 | +290 | ディザリングパターンの高さ(ピクセル)。 |
| hpalDefault | HPALETTE | 8/4 | +296 | +292 | 既定パレットへのハンドル(HPALETTE)。 |
| flGraphicsCaps2 | DWORD | 4 | +304 | +296 | 追加のグラフィックス機能フラグ(GCAPS2_*)。 |
各言語での定義
#include <windows.h>
// LOGFONTW (x64 92 / x86 92 バイト)
typedef struct LOGFONTW {
INT lfHeight;
INT lfWidth;
INT lfEscapement;
INT lfOrientation;
INT lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
FONT_CHARSET lfCharSet;
FONT_OUTPUT_PRECISION lfOutPrecision;
FONT_CLIP_PRECISION lfClipPrecision;
FONT_QUALITY lfQuality;
BYTE lfPitchAndFamily;
WCHAR lfFaceName[32];
} LOGFONTW;
// DEVINFO (x64 312 / x86 300 バイト)
typedef struct DEVINFO {
DWORD flGraphicsCaps;
LOGFONTW lfDefaultFont;
LOGFONTW lfAnsiVarFont;
LOGFONTW lfAnsiFixFont;
DWORD cFonts;
DWORD iDitherFormat;
WORD cxDither;
WORD cyDither;
HPALETTE hpalDefault;
DWORD flGraphicsCaps2;
} DEVINFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LOGFONTW
{
public int lfHeight;
public int lfWidth;
public int lfEscapement;
public int lfOrientation;
public int lfWeight;
public byte lfItalic;
public byte lfUnderline;
public byte lfStrikeOut;
public byte lfCharSet;
public byte lfOutPrecision;
public byte lfClipPrecision;
public byte lfQuality;
public byte lfPitchAndFamily;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string lfFaceName;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEVINFO
{
public uint flGraphicsCaps;
public LOGFONTW lfDefaultFont;
public LOGFONTW lfAnsiVarFont;
public LOGFONTW lfAnsiFixFont;
public uint cFonts;
public uint iDitherFormat;
public ushort cxDither;
public ushort cyDither;
public IntPtr hpalDefault;
public uint flGraphicsCaps2;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LOGFONTW
Public lfHeight As Integer
Public lfWidth As Integer
Public lfEscapement As Integer
Public lfOrientation As Integer
Public lfWeight As Integer
Public lfItalic As Byte
Public lfUnderline As Byte
Public lfStrikeOut As Byte
Public lfCharSet As Byte
Public lfOutPrecision As Byte
Public lfClipPrecision As Byte
Public lfQuality As Byte
Public lfPitchAndFamily As Byte
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public lfFaceName As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEVINFO
Public flGraphicsCaps As UInteger
Public lfDefaultFont As LOGFONTW
Public lfAnsiVarFont As LOGFONTW
Public lfAnsiFixFont As LOGFONTW
Public cFonts As UInteger
Public iDitherFormat As UInteger
Public cxDither As UShort
Public cyDither As UShort
Public hpalDefault As IntPtr
Public flGraphicsCaps2 As UInteger
End Structureimport ctypes
from ctypes import wintypes
class LOGFONTW(ctypes.Structure):
_fields_ = [
("lfHeight", ctypes.c_int),
("lfWidth", ctypes.c_int),
("lfEscapement", ctypes.c_int),
("lfOrientation", ctypes.c_int),
("lfWeight", ctypes.c_int),
("lfItalic", ctypes.c_ubyte),
("lfUnderline", ctypes.c_ubyte),
("lfStrikeOut", ctypes.c_ubyte),
("lfCharSet", ctypes.c_ubyte),
("lfOutPrecision", ctypes.c_ubyte),
("lfClipPrecision", ctypes.c_ubyte),
("lfQuality", ctypes.c_ubyte),
("lfPitchAndFamily", ctypes.c_ubyte),
("lfFaceName", ctypes.c_wchar * 32),
]
class DEVINFO(ctypes.Structure):
_fields_ = [
("flGraphicsCaps", wintypes.DWORD),
("lfDefaultFont", LOGFONTW),
("lfAnsiVarFont", LOGFONTW),
("lfAnsiFixFont", LOGFONTW),
("cFonts", wintypes.DWORD),
("iDitherFormat", wintypes.DWORD),
("cxDither", ctypes.c_ushort),
("cyDither", ctypes.c_ushort),
("hpalDefault", ctypes.c_void_p),
("flGraphicsCaps2", wintypes.DWORD),
]#[repr(C)]
pub struct LOGFONTW {
pub lfHeight: i32,
pub lfWidth: i32,
pub lfEscapement: i32,
pub lfOrientation: i32,
pub lfWeight: i32,
pub lfItalic: u8,
pub lfUnderline: u8,
pub lfStrikeOut: u8,
pub lfCharSet: u8,
pub lfOutPrecision: u8,
pub lfClipPrecision: u8,
pub lfQuality: u8,
pub lfPitchAndFamily: u8,
pub lfFaceName: [u16; 32],
}
#[repr(C)]
pub struct DEVINFO {
pub flGraphicsCaps: u32,
pub lfDefaultFont: LOGFONTW,
pub lfAnsiVarFont: LOGFONTW,
pub lfAnsiFixFont: LOGFONTW,
pub cFonts: u32,
pub iDitherFormat: u32,
pub cxDither: u16,
pub cyDither: u16,
pub hpalDefault: *mut core::ffi::c_void,
pub flGraphicsCaps2: u32,
}import "golang.org/x/sys/windows"
type LOGFONTW struct {
lfHeight int32
lfWidth int32
lfEscapement int32
lfOrientation int32
lfWeight int32
lfItalic byte
lfUnderline byte
lfStrikeOut byte
lfCharSet byte
lfOutPrecision byte
lfClipPrecision byte
lfQuality byte
lfPitchAndFamily byte
lfFaceName [32]uint16
}
type DEVINFO struct {
flGraphicsCaps uint32
lfDefaultFont LOGFONTW
lfAnsiVarFont LOGFONTW
lfAnsiFixFont LOGFONTW
cFonts uint32
iDitherFormat uint32
cxDither uint16
cyDither uint16
hpalDefault uintptr
flGraphicsCaps2 uint32
}type
LOGFONTW = record
lfHeight: Integer;
lfWidth: Integer;
lfEscapement: Integer;
lfOrientation: Integer;
lfWeight: Integer;
lfItalic: Byte;
lfUnderline: Byte;
lfStrikeOut: Byte;
lfCharSet: Byte;
lfOutPrecision: Byte;
lfClipPrecision: Byte;
lfQuality: Byte;
lfPitchAndFamily: Byte;
lfFaceName: array[0..31] of WideChar;
end;
DEVINFO = record
flGraphicsCaps: DWORD;
lfDefaultFont: LOGFONTW;
lfAnsiVarFont: LOGFONTW;
lfAnsiFixFont: LOGFONTW;
cFonts: DWORD;
iDitherFormat: DWORD;
cxDither: Word;
cyDither: Word;
hpalDefault: Pointer;
flGraphicsCaps2: DWORD;
end;const LOGFONTW = extern struct {
lfHeight: i32,
lfWidth: i32,
lfEscapement: i32,
lfOrientation: i32,
lfWeight: i32,
lfItalic: u8,
lfUnderline: u8,
lfStrikeOut: u8,
lfCharSet: u8,
lfOutPrecision: u8,
lfClipPrecision: u8,
lfQuality: u8,
lfPitchAndFamily: u8,
lfFaceName: [32]u16,
};
const DEVINFO = extern struct {
flGraphicsCaps: u32,
lfDefaultFont: LOGFONTW,
lfAnsiVarFont: LOGFONTW,
lfAnsiFixFont: LOGFONTW,
cFonts: u32,
iDitherFormat: u32,
cxDither: u16,
cyDither: u16,
hpalDefault: ?*anyopaque,
flGraphicsCaps2: u32,
};type
LOGFONTW {.bycopy.} = object
lfHeight: int32
lfWidth: int32
lfEscapement: int32
lfOrientation: int32
lfWeight: int32
lfItalic: uint8
lfUnderline: uint8
lfStrikeOut: uint8
lfCharSet: uint8
lfOutPrecision: uint8
lfClipPrecision: uint8
lfQuality: uint8
lfPitchAndFamily: uint8
lfFaceName: array[32, uint16]
DEVINFO {.bycopy.} = object
flGraphicsCaps: uint32
lfDefaultFont: LOGFONTW
lfAnsiVarFont: LOGFONTW
lfAnsiFixFont: LOGFONTW
cFonts: uint32
iDitherFormat: uint32
cxDither: uint16
cyDither: uint16
hpalDefault: pointer
flGraphicsCaps2: uint32struct LOGFONTW
{
int lfHeight;
int lfWidth;
int lfEscapement;
int lfOrientation;
int lfWeight;
ubyte lfItalic;
ubyte lfUnderline;
ubyte lfStrikeOut;
ubyte lfCharSet;
ubyte lfOutPrecision;
ubyte lfClipPrecision;
ubyte lfQuality;
ubyte lfPitchAndFamily;
wchar[32] lfFaceName;
}
struct DEVINFO
{
uint flGraphicsCaps;
LOGFONTW lfDefaultFont;
LOGFONTW lfAnsiVarFont;
LOGFONTW lfAnsiFixFont;
uint cFonts;
uint iDitherFormat;
ushort cxDither;
ushort cyDither;
void* hpalDefault;
uint flGraphicsCaps2;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DEVINFO サイズ: 300 バイト(x86)
dim st, 75 ; 4byte整数×75(構造体サイズ 300 / 4 切り上げ)
; flGraphicsCaps : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lfDefaultFont : LOGFONTW (+4, 92byte) varptr(st)+4 を基点に操作(92byte:入れ子/配列)
; lfAnsiVarFont : LOGFONTW (+96, 92byte) varptr(st)+96 を基点に操作(92byte:入れ子/配列)
; lfAnsiFixFont : LOGFONTW (+188, 92byte) varptr(st)+188 を基点に操作(92byte:入れ子/配列)
; cFonts : DWORD (+280, 4byte) st.70 = 値 / 値 = st.70 (lpoke/lpeek も可)
; iDitherFormat : DWORD (+284, 4byte) st.71 = 値 / 値 = st.71 (lpoke/lpeek も可)
; cxDither : WORD (+288, 2byte) wpoke st,288,値 / 値 = wpeek(st,288)
; cyDither : WORD (+290, 2byte) wpoke st,290,値 / 値 = wpeek(st,290)
; hpalDefault : HPALETTE (+292, 4byte) st.73 = 値 / 値 = st.73 (lpoke/lpeek も可)
; flGraphicsCaps2 : DWORD (+296, 4byte) st.74 = 値 / 値 = st.74 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEVINFO サイズ: 312 バイト(x64)
dim st, 78 ; 4byte整数×78(構造体サイズ 312 / 4 切り上げ)
; flGraphicsCaps : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lfDefaultFont : LOGFONTW (+4, 92byte) varptr(st)+4 を基点に操作(92byte:入れ子/配列)
; lfAnsiVarFont : LOGFONTW (+96, 92byte) varptr(st)+96 を基点に操作(92byte:入れ子/配列)
; lfAnsiFixFont : LOGFONTW (+188, 92byte) varptr(st)+188 を基点に操作(92byte:入れ子/配列)
; cFonts : DWORD (+280, 4byte) st.70 = 値 / 値 = st.70 (lpoke/lpeek も可)
; iDitherFormat : DWORD (+284, 4byte) st.71 = 値 / 値 = st.71 (lpoke/lpeek も可)
; cxDither : WORD (+288, 2byte) wpoke st,288,値 / 値 = wpeek(st,288)
; cyDither : WORD (+290, 2byte) wpoke st,290,値 / 値 = wpeek(st,290)
; hpalDefault : HPALETTE (+296, 8byte) qpoke st,296,値 / qpeek(st,296) ※IronHSPのみ。3.7/3.8は lpoke st,296,下位 : lpoke st,300,上位
; flGraphicsCaps2 : DWORD (+304, 4byte) st.76 = 値 / 値 = st.76 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LOGFONTW
#field int lfHeight
#field int lfWidth
#field int lfEscapement
#field int lfOrientation
#field int lfWeight
#field byte lfItalic
#field byte lfUnderline
#field byte lfStrikeOut
#field byte lfCharSet
#field byte lfOutPrecision
#field byte lfClipPrecision
#field byte lfQuality
#field byte lfPitchAndFamily
#field wchar lfFaceName 32
#endstruct
#defstruct global DEVINFO
#field int flGraphicsCaps
#field LOGFONTW lfDefaultFont
#field LOGFONTW lfAnsiVarFont
#field LOGFONTW lfAnsiFixFont
#field int cFonts
#field int iDitherFormat
#field short cxDither
#field short cyDither
#field intptr hpalDefault
#field int flGraphicsCaps2
#endstruct
stdim st, DEVINFO ; NSTRUCT 変数を確保
st->flGraphicsCaps = 100
mes "flGraphicsCaps=" + st->flGraphicsCaps