NONCLIENTMETRICSA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | 構造体のサイズ (バイト単位)。呼び出し元はこのメンバーに sizeof(NONCLIENTMETRICS) を設定する必要があります。アプリケーションの互換性については、「解説」を参照してください。 |
| iBorderWidth | INT | 4 | +4 | +4 | サイズ変更用の境界線の太さ (ピクセル単位)。既定値は 1 ピクセルです。 |
| iScrollWidth | INT | 4 | +8 | +8 | 標準的な垂直スクロールバーの幅 (ピクセル単位)。 |
| iScrollHeight | INT | 4 | +12 | +12 | 標準的な水平スクロールバーの高さ (ピクセル単位)。 |
| iCaptionWidth | INT | 4 | +16 | +16 | キャプションボタンの幅 (ピクセル単位)。 |
| iCaptionHeight | INT | 4 | +20 | +20 | キャプションボタンの高さ (ピクセル単位)。 |
| lfCaptionFont | LOGFONTA | 60 | +24 | +24 | キャプションフォントに関する情報を格納する LOGFONT 構造体。 |
| iSmCaptionWidth | INT | 4 | +84 | +84 | 小さいキャプションボタンの幅 (ピクセル単位)。 |
| iSmCaptionHeight | INT | 4 | +88 | +88 | 小さいキャプションの高さ (ピクセル単位)。 |
| lfSmCaptionFont | LOGFONTA | 60 | +92 | +92 | 小さいキャプションのフォントに関する情報を格納する LOGFONT 構造体。 |
| iMenuWidth | INT | 4 | +152 | +152 | メニューバーのボタンの幅 (ピクセル単位)。 |
| iMenuHeight | INT | 4 | +156 | +156 | メニューバーの高さ (ピクセル単位)。 |
| lfMenuFont | LOGFONTA | 60 | +160 | +160 | メニューバーで使用されるフォントに関する情報を格納する LOGFONT 構造体。 |
| lfStatusFont | LOGFONTA | 60 | +220 | +220 | ステータスバーおよびツールチップで使用されるフォントに関する情報を格納する LOGFONT 構造体。 |
| lfMessageFont | LOGFONTA | 60 | +280 | +280 | メッセージボックスで使用されるフォントに関する情報を格納する LOGFONT 構造体。 |
| iPaddedBorderWidth | INT | 4 | +340 | +340 | パディング境界線の太さ (ピクセル単位)。既定値は 4 ピクセルです。Windows Aero デスクトップ エクスペリエンスでは、サイズ変更可能なウィンドウとサイズ変更できないウィンドウのどちらについても、iPaddedBorderWidth メンバーと iBorderWidth メンバーが合算されます。このメンバーを使用するアプリケーションをコンパイルするには、_WIN32_WINNT を 0x0600 以降として定義します。詳細については、「解説」を参照してください。 Windows Server 2003 および Windows XP/2000: このメンバーはサポートされていません。 |
公式ドキュメント
最小化されていないウィンドウの非クライアント領域に関連付けられた、スケーラブルなメトリックを格納します。この構造体は、SystemParametersInfo 関数の SPI_GETNONCLIENTMETRICS アクションおよび SPI_SETNONCLIENTMETRICS アクションで使用されます。
解説(Remarks)
NONCLIENTMETRICS 構造体に iPaddedBorderWidth メンバーが存在する場合、この構造体は _WIN32_WINNT を 0x0502 以下としてコンパイルされたアプリケーションの場合よりも 4 バイト大きくなります。条件付きコンパイルの詳細については、「Using the Windows Headers」を参照してください。
Windows Server 2003 および Windows XP/2000: Windows Server 2008 または Windows Vista 向けにコンパイルされたアプリケーションを Windows Server 2003 または Windows XP/2000 でも実行する必要がある場合は、GetVersionEx 関数を使用して実行時にオペレーティングシステムのバージョンを確認し、Windows Server 2003 または Windows XP/2000 で実行されている場合は、SystemParametersInfo 関数を呼び出す前に、NONCLIENTMETRICS 構造体の cbSize メンバーから iPaddedBorderWidth メンバーのサイズを差し引いてください。
winuser.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして NONCLIENTMETRICS を定義しています。エンコーディング中立のエイリアスの使用と、エンコーディング中立でないコードを混在させると、不一致が生じ、コンパイルエラーや実行時エラーの原因となる場合があります。詳細については、「Conventions for Function Prototypes」を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// LOGFONTA (x64 60 / x86 60 バイト)
typedef struct LOGFONTA {
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;
CHAR lfFaceName[32];
} LOGFONTA;
// NONCLIENTMETRICSA (x64 344 / x86 344 バイト)
typedef struct NONCLIENTMETRICSA {
DWORD cbSize;
INT iBorderWidth;
INT iScrollWidth;
INT iScrollHeight;
INT iCaptionWidth;
INT iCaptionHeight;
LOGFONTA lfCaptionFont;
INT iSmCaptionWidth;
INT iSmCaptionHeight;
LOGFONTA lfSmCaptionFont;
INT iMenuWidth;
INT iMenuHeight;
LOGFONTA lfMenuFont;
LOGFONTA lfStatusFont;
LOGFONTA lfMessageFont;
INT iPaddedBorderWidth;
} NONCLIENTMETRICSA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LOGFONTA
{
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.ByValArray, SizeConst = 32)] public sbyte[] lfFaceName;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NONCLIENTMETRICSA
{
public uint cbSize;
public int iBorderWidth;
public int iScrollWidth;
public int iScrollHeight;
public int iCaptionWidth;
public int iCaptionHeight;
public LOGFONTA lfCaptionFont;
public int iSmCaptionWidth;
public int iSmCaptionHeight;
public LOGFONTA lfSmCaptionFont;
public int iMenuWidth;
public int iMenuHeight;
public LOGFONTA lfMenuFont;
public LOGFONTA lfStatusFont;
public LOGFONTA lfMessageFont;
public int iPaddedBorderWidth;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LOGFONTA
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.ByValArray, SizeConst:=32)> Public lfFaceName() As SByte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NONCLIENTMETRICSA
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 LOGFONTA
Public iSmCaptionWidth As Integer
Public iSmCaptionHeight As Integer
Public lfSmCaptionFont As LOGFONTA
Public iMenuWidth As Integer
Public iMenuHeight As Integer
Public lfMenuFont As LOGFONTA
Public lfStatusFont As LOGFONTA
Public lfMessageFont As LOGFONTA
Public iPaddedBorderWidth As Integer
End Structureimport ctypes
from ctypes import wintypes
class LOGFONTA(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_byte * 32),
]
class NONCLIENTMETRICSA(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", LOGFONTA),
("iSmCaptionWidth", ctypes.c_int),
("iSmCaptionHeight", ctypes.c_int),
("lfSmCaptionFont", LOGFONTA),
("iMenuWidth", ctypes.c_int),
("iMenuHeight", ctypes.c_int),
("lfMenuFont", LOGFONTA),
("lfStatusFont", LOGFONTA),
("lfMessageFont", LOGFONTA),
("iPaddedBorderWidth", ctypes.c_int),
]#[repr(C)]
pub struct LOGFONTA {
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: [i8; 32],
}
#[repr(C)]
pub struct NONCLIENTMETRICSA {
pub cbSize: u32,
pub iBorderWidth: i32,
pub iScrollWidth: i32,
pub iScrollHeight: i32,
pub iCaptionWidth: i32,
pub iCaptionHeight: i32,
pub lfCaptionFont: LOGFONTA,
pub iSmCaptionWidth: i32,
pub iSmCaptionHeight: i32,
pub lfSmCaptionFont: LOGFONTA,
pub iMenuWidth: i32,
pub iMenuHeight: i32,
pub lfMenuFont: LOGFONTA,
pub lfStatusFont: LOGFONTA,
pub lfMessageFont: LOGFONTA,
pub iPaddedBorderWidth: i32,
}import "golang.org/x/sys/windows"
type LOGFONTA 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]int8
}
type NONCLIENTMETRICSA struct {
cbSize uint32
iBorderWidth int32
iScrollWidth int32
iScrollHeight int32
iCaptionWidth int32
iCaptionHeight int32
lfCaptionFont LOGFONTA
iSmCaptionWidth int32
iSmCaptionHeight int32
lfSmCaptionFont LOGFONTA
iMenuWidth int32
iMenuHeight int32
lfMenuFont LOGFONTA
lfStatusFont LOGFONTA
lfMessageFont LOGFONTA
iPaddedBorderWidth int32
}type
LOGFONTA = 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 Shortint;
end;
NONCLIENTMETRICSA = record
cbSize: DWORD;
iBorderWidth: Integer;
iScrollWidth: Integer;
iScrollHeight: Integer;
iCaptionWidth: Integer;
iCaptionHeight: Integer;
lfCaptionFont: LOGFONTA;
iSmCaptionWidth: Integer;
iSmCaptionHeight: Integer;
lfSmCaptionFont: LOGFONTA;
iMenuWidth: Integer;
iMenuHeight: Integer;
lfMenuFont: LOGFONTA;
lfStatusFont: LOGFONTA;
lfMessageFont: LOGFONTA;
iPaddedBorderWidth: Integer;
end;const LOGFONTA = 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]i8,
};
const NONCLIENTMETRICSA = extern struct {
cbSize: u32,
iBorderWidth: i32,
iScrollWidth: i32,
iScrollHeight: i32,
iCaptionWidth: i32,
iCaptionHeight: i32,
lfCaptionFont: LOGFONTA,
iSmCaptionWidth: i32,
iSmCaptionHeight: i32,
lfSmCaptionFont: LOGFONTA,
iMenuWidth: i32,
iMenuHeight: i32,
lfMenuFont: LOGFONTA,
lfStatusFont: LOGFONTA,
lfMessageFont: LOGFONTA,
iPaddedBorderWidth: i32,
};type
LOGFONTA {.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, int8]
NONCLIENTMETRICSA {.bycopy.} = object
cbSize: uint32
iBorderWidth: int32
iScrollWidth: int32
iScrollHeight: int32
iCaptionWidth: int32
iCaptionHeight: int32
lfCaptionFont: LOGFONTA
iSmCaptionWidth: int32
iSmCaptionHeight: int32
lfSmCaptionFont: LOGFONTA
iMenuWidth: int32
iMenuHeight: int32
lfMenuFont: LOGFONTA
lfStatusFont: LOGFONTA
lfMessageFont: LOGFONTA
iPaddedBorderWidth: int32struct LOGFONTA
{
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;
byte[32] lfFaceName;
}
struct NONCLIENTMETRICSA
{
uint cbSize;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONTA lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONTA lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONTA lfMenuFont;
LOGFONTA lfStatusFont;
LOGFONTA 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 レイアウト)
; NONCLIENTMETRICSA サイズ: 344 バイト(x64)
dim st, 86 ; 4byte整数×86(構造体サイズ 344 / 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 : LOGFONTA (+24, 60byte) varptr(st)+24 を基点に操作(60byte:入れ子/配列)
; iSmCaptionWidth : INT (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; iSmCaptionHeight : INT (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; lfSmCaptionFont : LOGFONTA (+92, 60byte) varptr(st)+92 を基点に操作(60byte:入れ子/配列)
; iMenuWidth : INT (+152, 4byte) st.38 = 値 / 値 = st.38 (lpoke/lpeek も可)
; iMenuHeight : INT (+156, 4byte) st.39 = 値 / 値 = st.39 (lpoke/lpeek も可)
; lfMenuFont : LOGFONTA (+160, 60byte) varptr(st)+160 を基点に操作(60byte:入れ子/配列)
; lfStatusFont : LOGFONTA (+220, 60byte) varptr(st)+220 を基点に操作(60byte:入れ子/配列)
; lfMessageFont : LOGFONTA (+280, 60byte) varptr(st)+280 を基点に操作(60byte:入れ子/配列)
; iPaddedBorderWidth : INT (+340, 4byte) st.85 = 値 / 値 = st.85 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LOGFONTA
#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 byte lfFaceName 32
#endstruct
#defstruct global NONCLIENTMETRICSA
#field int cbSize
#field int iBorderWidth
#field int iScrollWidth
#field int iScrollHeight
#field int iCaptionWidth
#field int iCaptionHeight
#field LOGFONTA lfCaptionFont
#field int iSmCaptionWidth
#field int iSmCaptionHeight
#field LOGFONTA lfSmCaptionFont
#field int iMenuWidth
#field int iMenuHeight
#field LOGFONTA lfMenuFont
#field LOGFONTA lfStatusFont
#field LOGFONTA lfMessageFont
#field int iPaddedBorderWidth
#endstruct
stdim st, NONCLIENTMETRICSA ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize