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

NONCLIENTMETRICSW

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のサイズ(バイト数)である。
iBorderWidthINT4+4+4サイズ変更可能なウィンドウの境界線の幅(ピクセル)である。
iScrollWidthINT4+8+8垂直スクロールバーの幅(ピクセル)である。
iScrollHeightINT4+12+12水平スクロールバーの高さ(ピクセル)である。
iCaptionWidthINT4+16+16キャプションボタンの幅(ピクセル)である。
iCaptionHeightINT4+20+20キャプションの高さ(ピクセル)である。
lfCaptionFontLOGFONTW92+24+24キャプションに使用するフォントを示す LOGFONT(Unicode)である。
iSmCaptionWidthINT4+116+116小さいキャプションボタンの幅(ピクセル)である。
iSmCaptionHeightINT4+120+120小さいキャプションの高さ(ピクセル)である。
lfSmCaptionFontLOGFONTW92+124+124小さいキャプションに使用するフォントを示す LOGFONT(Unicode)である。
iMenuWidthINT4+216+216メニューバーボタンの幅(ピクセル)である。
iMenuHeightINT4+220+220メニューバーの高さ(ピクセル)である。
lfMenuFontLOGFONTW92+224+224メニューに使用するフォントを示す LOGFONT(Unicode)である。
lfStatusFontLOGFONTW92+316+316ステータスバーに使用するフォントを示す LOGFONT(Unicode)である。
lfMessageFontLOGFONTW92+408+408メッセージボックスに使用するフォントを示す LOGFONT(Unicode)である。
iPaddedBorderWidthINT4+500+500境界線に追加されるパディングの幅(ピクセル)である。

各言語での定義

#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;

// NONCLIENTMETRICSW  (x64 504 / x86 504 バイト)
typedef struct NONCLIENTMETRICSW {
    DWORD cbSize;
    INT iBorderWidth;
    INT iScrollWidth;
    INT iScrollHeight;
    INT iCaptionWidth;
    INT iCaptionHeight;
    LOGFONTW lfCaptionFont;
    INT iSmCaptionWidth;
    INT iSmCaptionHeight;
    LOGFONTW lfSmCaptionFont;
    INT iMenuWidth;
    INT iMenuHeight;
    LOGFONTW lfMenuFont;
    LOGFONTW lfStatusFont;
    LOGFONTW lfMessageFont;
    INT iPaddedBorderWidth;
} NONCLIENTMETRICSW;
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 NONCLIENTMETRICSW
{
    public uint cbSize;
    public int iBorderWidth;
    public int iScrollWidth;
    public int iScrollHeight;
    public int iCaptionWidth;
    public int iCaptionHeight;
    public LOGFONTW lfCaptionFont;
    public int iSmCaptionWidth;
    public int iSmCaptionHeight;
    public LOGFONTW lfSmCaptionFont;
    public int iMenuWidth;
    public int iMenuHeight;
    public LOGFONTW lfMenuFont;
    public LOGFONTW lfStatusFont;
    public LOGFONTW lfMessageFont;
    public int iPaddedBorderWidth;
}
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 NONCLIENTMETRICSW
    Public cbSize As UInteger
    Public iBorderWidth As Integer
    Public iScrollWidth As Integer
    Public iScrollHeight As Integer
    Public iCaptionWidth As Integer
    Public iCaptionHeight As Integer
    Public lfCaptionFont As LOGFONTW
    Public iSmCaptionWidth As Integer
    Public iSmCaptionHeight As Integer
    Public lfSmCaptionFont As LOGFONTW
    Public iMenuWidth As Integer
    Public iMenuHeight As Integer
    Public lfMenuFont As LOGFONTW
    Public lfStatusFont As LOGFONTW
    Public lfMessageFont As LOGFONTW
    Public iPaddedBorderWidth As Integer
End Structure
import 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 NONCLIENTMETRICSW(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("iBorderWidth", ctypes.c_int),
        ("iScrollWidth", ctypes.c_int),
        ("iScrollHeight", ctypes.c_int),
        ("iCaptionWidth", ctypes.c_int),
        ("iCaptionHeight", ctypes.c_int),
        ("lfCaptionFont", LOGFONTW),
        ("iSmCaptionWidth", ctypes.c_int),
        ("iSmCaptionHeight", ctypes.c_int),
        ("lfSmCaptionFont", LOGFONTW),
        ("iMenuWidth", ctypes.c_int),
        ("iMenuHeight", ctypes.c_int),
        ("lfMenuFont", LOGFONTW),
        ("lfStatusFont", LOGFONTW),
        ("lfMessageFont", LOGFONTW),
        ("iPaddedBorderWidth", ctypes.c_int),
    ]
#[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 NONCLIENTMETRICSW {
    pub cbSize: u32,
    pub iBorderWidth: i32,
    pub iScrollWidth: i32,
    pub iScrollHeight: i32,
    pub iCaptionWidth: i32,
    pub iCaptionHeight: i32,
    pub lfCaptionFont: LOGFONTW,
    pub iSmCaptionWidth: i32,
    pub iSmCaptionHeight: i32,
    pub lfSmCaptionFont: LOGFONTW,
    pub iMenuWidth: i32,
    pub iMenuHeight: i32,
    pub lfMenuFont: LOGFONTW,
    pub lfStatusFont: LOGFONTW,
    pub lfMessageFont: LOGFONTW,
    pub iPaddedBorderWidth: i32,
}
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 NONCLIENTMETRICSW struct {
	cbSize uint32
	iBorderWidth int32
	iScrollWidth int32
	iScrollHeight int32
	iCaptionWidth int32
	iCaptionHeight int32
	lfCaptionFont LOGFONTW
	iSmCaptionWidth int32
	iSmCaptionHeight int32
	lfSmCaptionFont LOGFONTW
	iMenuWidth int32
	iMenuHeight int32
	lfMenuFont LOGFONTW
	lfStatusFont LOGFONTW
	lfMessageFont LOGFONTW
	iPaddedBorderWidth int32
}
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;

  NONCLIENTMETRICSW = record
    cbSize: DWORD;
    iBorderWidth: Integer;
    iScrollWidth: Integer;
    iScrollHeight: Integer;
    iCaptionWidth: Integer;
    iCaptionHeight: Integer;
    lfCaptionFont: LOGFONTW;
    iSmCaptionWidth: Integer;
    iSmCaptionHeight: Integer;
    lfSmCaptionFont: LOGFONTW;
    iMenuWidth: Integer;
    iMenuHeight: Integer;
    lfMenuFont: LOGFONTW;
    lfStatusFont: LOGFONTW;
    lfMessageFont: LOGFONTW;
    iPaddedBorderWidth: Integer;
  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 NONCLIENTMETRICSW = extern struct {
    cbSize: u32,
    iBorderWidth: i32,
    iScrollWidth: i32,
    iScrollHeight: i32,
    iCaptionWidth: i32,
    iCaptionHeight: i32,
    lfCaptionFont: LOGFONTW,
    iSmCaptionWidth: i32,
    iSmCaptionHeight: i32,
    lfSmCaptionFont: LOGFONTW,
    iMenuWidth: i32,
    iMenuHeight: i32,
    lfMenuFont: LOGFONTW,
    lfStatusFont: LOGFONTW,
    lfMessageFont: LOGFONTW,
    iPaddedBorderWidth: i32,
};
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]

  NONCLIENTMETRICSW {.bycopy.} = object
    cbSize: uint32
    iBorderWidth: int32
    iScrollWidth: int32
    iScrollHeight: int32
    iCaptionWidth: int32
    iCaptionHeight: int32
    lfCaptionFont: LOGFONTW
    iSmCaptionWidth: int32
    iSmCaptionHeight: int32
    lfSmCaptionFont: LOGFONTW
    iMenuWidth: int32
    iMenuHeight: int32
    lfMenuFont: LOGFONTW
    lfStatusFont: LOGFONTW
    lfMessageFont: LOGFONTW
    iPaddedBorderWidth: int32
struct 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 NONCLIENTMETRICSW
{
    uint cbSize;
    int iBorderWidth;
    int iScrollWidth;
    int iScrollHeight;
    int iCaptionWidth;
    int iCaptionHeight;
    LOGFONTW lfCaptionFont;
    int iSmCaptionWidth;
    int iSmCaptionHeight;
    LOGFONTW lfSmCaptionFont;
    int iMenuWidth;
    int iMenuHeight;
    LOGFONTW lfMenuFont;
    LOGFONTW lfStatusFont;
    LOGFONTW lfMessageFont;
    int iPaddedBorderWidth;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NONCLIENTMETRICSW サイズ: 504 バイト(x64)
dim st, 126    ; 4byte整数×126(構造体サイズ 504 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; iBorderWidth : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; iScrollWidth : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; iScrollHeight : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; iCaptionWidth : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; iCaptionHeight : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; lfCaptionFont : LOGFONTW (+24, 92byte)  varptr(st)+24 を基点に操作(92byte:入れ子/配列)
; iSmCaptionWidth : INT (+116, 4byte)  st.29 = 値  /  値 = st.29   (lpoke/lpeek も可)
; iSmCaptionHeight : INT (+120, 4byte)  st.30 = 値  /  値 = st.30   (lpoke/lpeek も可)
; lfSmCaptionFont : LOGFONTW (+124, 92byte)  varptr(st)+124 を基点に操作(92byte:入れ子/配列)
; iMenuWidth : INT (+216, 4byte)  st.54 = 値  /  値 = st.54   (lpoke/lpeek も可)
; iMenuHeight : INT (+220, 4byte)  st.55 = 値  /  値 = st.55   (lpoke/lpeek も可)
; lfMenuFont : LOGFONTW (+224, 92byte)  varptr(st)+224 を基点に操作(92byte:入れ子/配列)
; lfStatusFont : LOGFONTW (+316, 92byte)  varptr(st)+316 を基点に操作(92byte:入れ子/配列)
; lfMessageFont : LOGFONTW (+408, 92byte)  varptr(st)+408 を基点に操作(92byte:入れ子/配列)
; iPaddedBorderWidth : INT (+500, 4byte)  st.125 = 値  /  値 = st.125   (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 NONCLIENTMETRICSW
    #field int cbSize
    #field int iBorderWidth
    #field int iScrollWidth
    #field int iScrollHeight
    #field int iCaptionWidth
    #field int iCaptionHeight
    #field LOGFONTW lfCaptionFont
    #field int iSmCaptionWidth
    #field int iSmCaptionHeight
    #field LOGFONTW lfSmCaptionFont
    #field int iMenuWidth
    #field int iMenuHeight
    #field LOGFONTW lfMenuFont
    #field LOGFONTW lfStatusFont
    #field LOGFONTW lfMessageFont
    #field int iPaddedBorderWidth
#endstruct

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