ホーム › UI.WindowsAndMessaging › MENUINFO
MENUINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | 構造体のサイズ (バイト単位)。呼び出し元は、このメンバーに sizeof(MENUINFO) を設定しなければなりません。 | ||||||||||||||
| fMask | MENUINFO_MASK | 4 | +4 | +4 | 取得または設定するメンバーを示します (MIM_APPLYTOSUBMENUS を除く)。このメンバーには、次の値の 1 つ以上を指定できます。
| ||||||||||||||
| dwStyle | MENUINFO_STYLE | 4 | +8 | +8 | メニューのスタイル。このメンバーには、次の値の 1 つ以上を指定できます。
| ||||||||||||||
| cyMax | DWORD | 4 | +12 | +12 | メニューの最大の高さ (ピクセル単位)。メニュー項目が使用可能な領域を超える場合は、スクロールバーが自動的に使用されます。既定値 (0) は画面の高さです。 | ||||||||||||||
| hbrBack | HBRUSH | 8/4 | +16 | +16 | メニューの背景に使用するブラシへのハンドル。 | ||||||||||||||
| dwContextHelpID | DWORD | 4 | +24 | +20 | コンテキストヘルプ識別子。これは GetMenuContextHelpId 関数および SetMenuContextHelpId 関数で使用されるものと同じ値です。 | ||||||||||||||
| dwMenuData | UINT_PTR | 8/4 | +32 | +24 | アプリケーション定義の値。 |
公式ドキュメント
メニューに関する情報を格納します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#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