ホーム › UI.WindowsAndMessaging › MENUINFO
MENUINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のサイズ(バイト数)である。 |
| fMask | MENUINFO_MASK | 4 | +4 | +4 | 取得または設定するメンバを示すマスクである。 |
| dwStyle | MENUINFO_STYLE | 4 | +8 | +8 | メニューのスタイルである。 |
| cyMax | DWORD | 4 | +12 | +12 | メニューの最大高さ(ピクセル)である。0 の場合は既定の高さが使われる。 |
| hbrBack | HBRUSH | 8/4 | +16 | +16 | メニューの背景ブラシのハンドルである。 |
| dwContextHelpID | DWORD | 4 | +24 | +20 | メニューに関連付けられたコンテキストヘルプ ID である。 |
| dwMenuData | UINT_PTR | 8/4 | +32 | +24 | メニューに関連付けられたアプリケーション定義の値である。 |
各言語での定義
#include <windows.h>
// MENUINFO (x64 40 / x86 28 バイト)
typedef struct MENUINFO {
DWORD cbSize;
MENUINFO_MASK fMask;
MENUINFO_STYLE dwStyle;
DWORD cyMax;
HBRUSH hbrBack;
DWORD dwContextHelpID;
UINT_PTR dwMenuData;
} MENUINFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MENUINFO
{
public uint cbSize;
public uint fMask;
public uint dwStyle;
public uint cyMax;
public IntPtr hbrBack;
public uint dwContextHelpID;
public UIntPtr dwMenuData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MENUINFO
Public cbSize As UInteger
Public fMask As UInteger
Public dwStyle As UInteger
Public cyMax As UInteger
Public hbrBack As IntPtr
Public dwContextHelpID As UInteger
Public dwMenuData As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class MENUINFO(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("fMask", wintypes.DWORD),
("dwStyle", wintypes.DWORD),
("cyMax", wintypes.DWORD),
("hbrBack", ctypes.c_void_p),
("dwContextHelpID", wintypes.DWORD),
("dwMenuData", ctypes.c_size_t),
]#[repr(C)]
pub struct MENUINFO {
pub cbSize: u32,
pub fMask: u32,
pub dwStyle: u32,
pub cyMax: u32,
pub hbrBack: *mut core::ffi::c_void,
pub dwContextHelpID: u32,
pub dwMenuData: usize,
}import "golang.org/x/sys/windows"
type MENUINFO struct {
cbSize uint32
fMask uint32
dwStyle uint32
cyMax uint32
hbrBack uintptr
dwContextHelpID uint32
dwMenuData uintptr
}type
MENUINFO = record
cbSize: DWORD;
fMask: DWORD;
dwStyle: DWORD;
cyMax: DWORD;
hbrBack: Pointer;
dwContextHelpID: DWORD;
dwMenuData: NativeUInt;
end;const MENUINFO = extern struct {
cbSize: u32,
fMask: u32,
dwStyle: u32,
cyMax: u32,
hbrBack: ?*anyopaque,
dwContextHelpID: u32,
dwMenuData: usize,
};type
MENUINFO {.bycopy.} = object
cbSize: uint32
fMask: uint32
dwStyle: uint32
cyMax: uint32
hbrBack: pointer
dwContextHelpID: uint32
dwMenuData: uintstruct MENUINFO
{
uint cbSize;
uint fMask;
uint dwStyle;
uint cyMax;
void* hbrBack;
uint dwContextHelpID;
size_t dwMenuData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MENUINFO サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fMask : MENUINFO_MASK (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwStyle : MENUINFO_STYLE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cyMax : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; hbrBack : HBRUSH (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwContextHelpID : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwMenuData : UINT_PTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MENUINFO サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fMask : MENUINFO_MASK (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwStyle : MENUINFO_STYLE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cyMax : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; hbrBack : HBRUSH (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwContextHelpID : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwMenuData : UINT_PTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MENUINFO
#field int cbSize
#field int fMask
#field int dwStyle
#field int cyMax
#field intptr hbrBack
#field int dwContextHelpID
#field intptr dwMenuData
#endstruct
stdim st, MENUINFO ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize