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

FD_GLYPHATTR

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

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

フィールド

フィールドサイズx64x86説明
cjThisDWORD4+0+0この構造体全体のバイトサイズ。
cGlyphsDWORD4+4+4属性情報を持つグリフ数。
iModeDWORD4+8+8属性データの形式(モード)。
aGlyphAttrBYTE1+12+12各グリフの属性を格納するバイト配列(可変長)。

各言語での定義

#include <windows.h>

// FD_GLYPHATTR  (x64 16 / x86 16 バイト)
typedef struct FD_GLYPHATTR {
    DWORD cjThis;
    DWORD cGlyphs;
    DWORD iMode;
    BYTE aGlyphAttr[1];
} FD_GLYPHATTR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FD_GLYPHATTR
{
    public uint cjThis;
    public uint cGlyphs;
    public uint iMode;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] aGlyphAttr;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FD_GLYPHATTR
    Public cjThis As UInteger
    Public cGlyphs As UInteger
    Public iMode As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public aGlyphAttr() As Byte
End Structure
import ctypes
from ctypes import wintypes

class FD_GLYPHATTR(ctypes.Structure):
    _fields_ = [
        ("cjThis", wintypes.DWORD),
        ("cGlyphs", wintypes.DWORD),
        ("iMode", wintypes.DWORD),
        ("aGlyphAttr", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct FD_GLYPHATTR {
    pub cjThis: u32,
    pub cGlyphs: u32,
    pub iMode: u32,
    pub aGlyphAttr: [u8; 1],
}
import "golang.org/x/sys/windows"

type FD_GLYPHATTR struct {
	cjThis uint32
	cGlyphs uint32
	iMode uint32
	aGlyphAttr [1]byte
}
type
  FD_GLYPHATTR = record
    cjThis: DWORD;
    cGlyphs: DWORD;
    iMode: DWORD;
    aGlyphAttr: array[0..0] of Byte;
  end;
const FD_GLYPHATTR = extern struct {
    cjThis: u32,
    cGlyphs: u32,
    iMode: u32,
    aGlyphAttr: [1]u8,
};
type
  FD_GLYPHATTR {.bycopy.} = object
    cjThis: uint32
    cGlyphs: uint32
    iMode: uint32
    aGlyphAttr: array[1, uint8]
struct FD_GLYPHATTR
{
    uint cjThis;
    uint cGlyphs;
    uint iMode;
    ubyte[1] aGlyphAttr;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FD_GLYPHATTR サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; cjThis : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cGlyphs : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; iMode : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; aGlyphAttr : BYTE (+12, 1byte)  varptr(st)+12 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FD_GLYPHATTR
    #field int cjThis
    #field int cGlyphs
    #field int iMode
    #field byte aGlyphAttr 1
#endstruct

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