ホーム › System.Mmc › CONTEXTMENUITEM
CONTEXTMENUITEM
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| strName | LPWSTR | 8/4 | +0 | +0 | メニュー項目に表示するテキスト。 |
| strStatusBarText | LPWSTR | 8/4 | +8 | +4 | 項目選択時にステータスバーに表示するヘルプテキスト。 |
| lCommandID | INT | 4 | +16 | +8 | メニュー項目選択時に送られるコマンドID。 |
| lInsertionPointID | INT | 4 | +20 | +12 | メニュー内でこの項目を挿入する挿入ポイントID。 |
| fFlags | INT | 4 | +24 | +16 | 項目の状態フラグ(MF_GRAYED等)。 |
| fSpecialFlags | INT | 4 | +28 | +20 | 特殊動作を示すフラグ(既定項目等)。 |
各言語での定義
#include <windows.h>
// CONTEXTMENUITEM (x64 32 / x86 24 バイト)
typedef struct CONTEXTMENUITEM {
LPWSTR strName;
LPWSTR strStatusBarText;
INT lCommandID;
INT lInsertionPointID;
INT fFlags;
INT fSpecialFlags;
} CONTEXTMENUITEM;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CONTEXTMENUITEM
{
public IntPtr strName;
public IntPtr strStatusBarText;
public int lCommandID;
public int lInsertionPointID;
public int fFlags;
public int fSpecialFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CONTEXTMENUITEM
Public strName As IntPtr
Public strStatusBarText As IntPtr
Public lCommandID As Integer
Public lInsertionPointID As Integer
Public fFlags As Integer
Public fSpecialFlags As Integer
End Structureimport ctypes
from ctypes import wintypes
class CONTEXTMENUITEM(ctypes.Structure):
_fields_ = [
("strName", ctypes.c_void_p),
("strStatusBarText", ctypes.c_void_p),
("lCommandID", ctypes.c_int),
("lInsertionPointID", ctypes.c_int),
("fFlags", ctypes.c_int),
("fSpecialFlags", ctypes.c_int),
]#[repr(C)]
pub struct CONTEXTMENUITEM {
pub strName: *mut core::ffi::c_void,
pub strStatusBarText: *mut core::ffi::c_void,
pub lCommandID: i32,
pub lInsertionPointID: i32,
pub fFlags: i32,
pub fSpecialFlags: i32,
}import "golang.org/x/sys/windows"
type CONTEXTMENUITEM struct {
strName uintptr
strStatusBarText uintptr
lCommandID int32
lInsertionPointID int32
fFlags int32
fSpecialFlags int32
}type
CONTEXTMENUITEM = record
strName: Pointer;
strStatusBarText: Pointer;
lCommandID: Integer;
lInsertionPointID: Integer;
fFlags: Integer;
fSpecialFlags: Integer;
end;const CONTEXTMENUITEM = extern struct {
strName: ?*anyopaque,
strStatusBarText: ?*anyopaque,
lCommandID: i32,
lInsertionPointID: i32,
fFlags: i32,
fSpecialFlags: i32,
};type
CONTEXTMENUITEM {.bycopy.} = object
strName: pointer
strStatusBarText: pointer
lCommandID: int32
lInsertionPointID: int32
fFlags: int32
fSpecialFlags: int32struct CONTEXTMENUITEM
{
void* strName;
void* strStatusBarText;
int lCommandID;
int lInsertionPointID;
int fFlags;
int fSpecialFlags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CONTEXTMENUITEM サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; strName : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; strStatusBarText : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; lCommandID : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lInsertionPointID : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; fFlags : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; fSpecialFlags : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CONTEXTMENUITEM サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; strName : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; strStatusBarText : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; lCommandID : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; lInsertionPointID : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; fFlags : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; fSpecialFlags : INT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CONTEXTMENUITEM
#field intptr strName
#field intptr strStatusBarText
#field int lCommandID
#field int lInsertionPointID
#field int fFlags
#field int fSpecialFlags
#endstruct
stdim st, CONTEXTMENUITEM ; NSTRUCT 変数を確保
st->lCommandID = 100
mes "lCommandID=" + st->lCommandID