Win32 API 日本語リファレンス
ホームUI.Controls › DTTOPTS

DTTOPTS

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のバイトサイズ。呼び出し前に設定する。
dwFlagsDTTOPTS_FLAGS4+4+4有効なメンバーや描画オプションを示すフラグ(DTTOPTS_FLAGS、DTT_*)。
crTextCOLORREF4+8+8テキストの色(COLORREF)。
crBorderCOLORREF4+12+12テキスト枠線の色(COLORREF)。
crShadowCOLORREF4+16+16テキスト影の色(COLORREF)。
iTextShadowTypeINT4+20+20影の種類(TST_*、なし・単色・連続)。
ptShadowOffsetPOINT8+24+24影の表示オフセット(POINT)。
iBorderSizeINT4+32+32枠線の太さ(ピクセル)。
iFontPropIdINT4+36+36使用するフォントのプロパティID。
iColorPropIdINT4+40+40使用する色のプロパティID。
iStateIdINT4+44+44描画する部分の状態ID。
fApplyOverlayBOOL4+48+48オーバーレイを適用するかを示すブール値。
iGlowSizeINT4+52+52グロー効果のサイズ(ピクセル)。
pfnDrawTextCallbackDTT_CALLBACK_PROC8/4+56+56テキスト描画をカスタマイズするコールバック(DTT_CALLBACK_PROC)。
lParamLPARAM8/4+64+60コールバックに渡すアプリケーション定義値。

各言語での定義

#include <windows.h>

// POINT  (x64 8 / x86 8 バイト)
typedef struct POINT {
    INT x;
    INT y;
} POINT;

// DTTOPTS  (x64 72 / x86 64 バイト)
typedef struct DTTOPTS {
    DWORD dwSize;
    DTTOPTS_FLAGS dwFlags;
    COLORREF crText;
    COLORREF crBorder;
    COLORREF crShadow;
    INT iTextShadowType;
    POINT ptShadowOffset;
    INT iBorderSize;
    INT iFontPropId;
    INT iColorPropId;
    INT iStateId;
    BOOL fApplyOverlay;
    INT iGlowSize;
    DTT_CALLBACK_PROC pfnDrawTextCallback;
    LPARAM lParam;
} DTTOPTS;
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 DTTOPTS
{
    public uint dwSize;
    public uint dwFlags;
    public uint crText;
    public uint crBorder;
    public uint crShadow;
    public int iTextShadowType;
    public POINT ptShadowOffset;
    public int iBorderSize;
    public int iFontPropId;
    public int iColorPropId;
    public int iStateId;
    [MarshalAs(UnmanagedType.Bool)] public bool fApplyOverlay;
    public int iGlowSize;
    public IntPtr pfnDrawTextCallback;
    public IntPtr lParam;
}
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 DTTOPTS
    Public dwSize As UInteger
    Public dwFlags As UInteger
    Public crText As UInteger
    Public crBorder As UInteger
    Public crShadow As UInteger
    Public iTextShadowType As Integer
    Public ptShadowOffset As POINT
    Public iBorderSize As Integer
    Public iFontPropId As Integer
    Public iColorPropId As Integer
    Public iStateId As Integer
    <MarshalAs(UnmanagedType.Bool)> Public fApplyOverlay As Boolean
    Public iGlowSize As Integer
    Public pfnDrawTextCallback As IntPtr
    Public lParam As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class POINT(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_int),
        ("y", ctypes.c_int),
    ]

class DTTOPTS(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("crText", wintypes.DWORD),
        ("crBorder", wintypes.DWORD),
        ("crShadow", wintypes.DWORD),
        ("iTextShadowType", ctypes.c_int),
        ("ptShadowOffset", POINT),
        ("iBorderSize", ctypes.c_int),
        ("iFontPropId", ctypes.c_int),
        ("iColorPropId", ctypes.c_int),
        ("iStateId", ctypes.c_int),
        ("fApplyOverlay", wintypes.BOOL),
        ("iGlowSize", ctypes.c_int),
        ("pfnDrawTextCallback", ctypes.c_void_p),
        ("lParam", ctypes.c_ssize_t),
    ]
#[repr(C)]
pub struct POINT {
    pub x: i32,
    pub y: i32,
}

#[repr(C)]
pub struct DTTOPTS {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub crText: u32,
    pub crBorder: u32,
    pub crShadow: u32,
    pub iTextShadowType: i32,
    pub ptShadowOffset: POINT,
    pub iBorderSize: i32,
    pub iFontPropId: i32,
    pub iColorPropId: i32,
    pub iStateId: i32,
    pub fApplyOverlay: i32,
    pub iGlowSize: i32,
    pub pfnDrawTextCallback: *mut core::ffi::c_void,
    pub lParam: isize,
}
import "golang.org/x/sys/windows"

type POINT struct {
	x int32
	y int32
}

type DTTOPTS struct {
	dwSize uint32
	dwFlags uint32
	crText uint32
	crBorder uint32
	crShadow uint32
	iTextShadowType int32
	ptShadowOffset POINT
	iBorderSize int32
	iFontPropId int32
	iColorPropId int32
	iStateId int32
	fApplyOverlay int32
	iGlowSize int32
	pfnDrawTextCallback uintptr
	lParam uintptr
}
type
  POINT = record
    x: Integer;
    y: Integer;
  end;

  DTTOPTS = record
    dwSize: DWORD;
    dwFlags: DWORD;
    crText: DWORD;
    crBorder: DWORD;
    crShadow: DWORD;
    iTextShadowType: Integer;
    ptShadowOffset: POINT;
    iBorderSize: Integer;
    iFontPropId: Integer;
    iColorPropId: Integer;
    iStateId: Integer;
    fApplyOverlay: BOOL;
    iGlowSize: Integer;
    pfnDrawTextCallback: Pointer;
    lParam: NativeInt;
  end;
const POINT = extern struct {
    x: i32,
    y: i32,
};

const DTTOPTS = extern struct {
    dwSize: u32,
    dwFlags: u32,
    crText: u32,
    crBorder: u32,
    crShadow: u32,
    iTextShadowType: i32,
    ptShadowOffset: POINT,
    iBorderSize: i32,
    iFontPropId: i32,
    iColorPropId: i32,
    iStateId: i32,
    fApplyOverlay: i32,
    iGlowSize: i32,
    pfnDrawTextCallback: ?*anyopaque,
    lParam: isize,
};
type
  POINT {.bycopy.} = object
    x: int32
    y: int32

  DTTOPTS {.bycopy.} = object
    dwSize: uint32
    dwFlags: uint32
    crText: uint32
    crBorder: uint32
    crShadow: uint32
    iTextShadowType: int32
    ptShadowOffset: POINT
    iBorderSize: int32
    iFontPropId: int32
    iColorPropId: int32
    iStateId: int32
    fApplyOverlay: int32
    iGlowSize: int32
    pfnDrawTextCallback: pointer
    lParam: int
struct POINT
{
    int x;
    int y;
}

struct DTTOPTS
{
    uint dwSize;
    uint dwFlags;
    uint crText;
    uint crBorder;
    uint crShadow;
    int iTextShadowType;
    POINT ptShadowOffset;
    int iBorderSize;
    int iFontPropId;
    int iColorPropId;
    int iStateId;
    int fApplyOverlay;
    int iGlowSize;
    void* pfnDrawTextCallback;
    ptrdiff_t lParam;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DTTOPTS サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DTTOPTS_FLAGS (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; crText : COLORREF (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; crBorder : COLORREF (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; crShadow : COLORREF (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; iTextShadowType : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ptShadowOffset : POINT (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; iBorderSize : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; iFontPropId : INT (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; iColorPropId : INT (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; iStateId : INT (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; fApplyOverlay : BOOL (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; iGlowSize : INT (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; pfnDrawTextCallback : DTT_CALLBACK_PROC (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; lParam : LPARAM (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DTTOPTS サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DTTOPTS_FLAGS (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; crText : COLORREF (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; crBorder : COLORREF (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; crShadow : COLORREF (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; iTextShadowType : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ptShadowOffset : POINT (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; iBorderSize : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; iFontPropId : INT (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; iColorPropId : INT (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; iStateId : INT (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; fApplyOverlay : BOOL (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; iGlowSize : INT (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; pfnDrawTextCallback : DTT_CALLBACK_PROC (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; lParam : LPARAM (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※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 DTTOPTS
    #field int dwSize
    #field int dwFlags
    #field int crText
    #field int crBorder
    #field int crShadow
    #field int iTextShadowType
    #field POINT ptShadowOffset
    #field int iBorderSize
    #field int iFontPropId
    #field int iColorPropId
    #field int iStateId
    #field bool fApplyOverlay
    #field int iGlowSize
    #field intptr pfnDrawTextCallback
    #field intptr lParam
#endstruct

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