NONCLIENTMETRICSW
構造体サイズ=各フィールドのバイト数(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 | LOGFONTW | 92 | +24 | +24 | キャプション フォントに関する情報を格納する LOGFONT 構造体です。 |
| iSmCaptionWidth | INT | 4 | +116 | +116 | 小さいキャプション ボタンの幅 (ピクセル単位)。 |
| iSmCaptionHeight | INT | 4 | +120 | +120 | 小さいキャプションの高さ (ピクセル単位)。 |
| lfSmCaptionFont | LOGFONTW | 92 | +124 | +124 | 小さいキャプションのフォントに関する情報を格納する LOGFONT 構造体です。 |
| iMenuWidth | INT | 4 | +216 | +216 | メニュー バーのボタンの幅 (ピクセル単位)。 |
| iMenuHeight | INT | 4 | +220 | +220 | メニュー バーの高さ (ピクセル単位)。 |
| lfMenuFont | LOGFONTW | 92 | +224 | +224 | メニュー バーで使用されるフォントに関する情報を格納する LOGFONT 構造体です。 |
| lfStatusFont | LOGFONTW | 92 | +316 | +316 | ステータス バーおよびツールヒントで使用されるフォントに関する情報を格納する LOGFONT 構造体です。 |
| lfMessageFont | LOGFONTW | 92 | +408 | +408 | メッセージ ボックスで使用されるフォントに関する情報を格納する LOGFONT 構造体です。 |
| iPaddedBorderWidth | INT | 4 | +500 | +500 | パディングされた境界線の太さ (ピクセル単位)。既定値は 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>
// 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 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 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: int32struct 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