UI_EVENTPARAMS_COMMAND
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| CommandID | DWORD | 4 | +0 | +0 | イベント対象のコマンドID。 |
| CommandName | LPWSTR | 8/4 | +8 | +4 | コマンド名の文字列。 |
| ParentCommandID | DWORD | 4 | +16 | +8 | 親コマンドのID。メニューやギャラリーの所属を示す。 |
| ParentCommandName | LPWSTR | 8/4 | +24 | +12 | 親コマンドの名前文字列。 |
| SelectionIndex | DWORD | 4 | +32 | +16 | 選択された項目のインデックス。ギャラリー等で選んだ位置を示す。 |
| Location | UI_EVENTLOCATION | 4 | +36 | +20 | イベントの発生位置(リボン上の場所)。 |
各言語での定義
#include <windows.h>
// UI_EVENTPARAMS_COMMAND (x64 40 / x86 24 バイト)
typedef struct UI_EVENTPARAMS_COMMAND {
DWORD CommandID;
LPWSTR CommandName;
DWORD ParentCommandID;
LPWSTR ParentCommandName;
DWORD SelectionIndex;
UI_EVENTLOCATION Location;
} UI_EVENTPARAMS_COMMAND;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UI_EVENTPARAMS_COMMAND
{
public uint CommandID;
public IntPtr CommandName;
public uint ParentCommandID;
public IntPtr ParentCommandName;
public uint SelectionIndex;
public int Location;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UI_EVENTPARAMS_COMMAND
Public CommandID As UInteger
Public CommandName As IntPtr
Public ParentCommandID As UInteger
Public ParentCommandName As IntPtr
Public SelectionIndex As UInteger
Public Location As Integer
End Structureimport ctypes
from ctypes import wintypes
class UI_EVENTPARAMS_COMMAND(ctypes.Structure):
_fields_ = [
("CommandID", wintypes.DWORD),
("CommandName", ctypes.c_void_p),
("ParentCommandID", wintypes.DWORD),
("ParentCommandName", ctypes.c_void_p),
("SelectionIndex", wintypes.DWORD),
("Location", ctypes.c_int),
]#[repr(C)]
pub struct UI_EVENTPARAMS_COMMAND {
pub CommandID: u32,
pub CommandName: *mut core::ffi::c_void,
pub ParentCommandID: u32,
pub ParentCommandName: *mut core::ffi::c_void,
pub SelectionIndex: u32,
pub Location: i32,
}import "golang.org/x/sys/windows"
type UI_EVENTPARAMS_COMMAND struct {
CommandID uint32
CommandName uintptr
ParentCommandID uint32
ParentCommandName uintptr
SelectionIndex uint32
Location int32
}type
UI_EVENTPARAMS_COMMAND = record
CommandID: DWORD;
CommandName: Pointer;
ParentCommandID: DWORD;
ParentCommandName: Pointer;
SelectionIndex: DWORD;
Location: Integer;
end;const UI_EVENTPARAMS_COMMAND = extern struct {
CommandID: u32,
CommandName: ?*anyopaque,
ParentCommandID: u32,
ParentCommandName: ?*anyopaque,
SelectionIndex: u32,
Location: i32,
};type
UI_EVENTPARAMS_COMMAND {.bycopy.} = object
CommandID: uint32
CommandName: pointer
ParentCommandID: uint32
ParentCommandName: pointer
SelectionIndex: uint32
Location: int32struct UI_EVENTPARAMS_COMMAND
{
uint CommandID;
void* CommandName;
uint ParentCommandID;
void* ParentCommandName;
uint SelectionIndex;
int Location;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; UI_EVENTPARAMS_COMMAND サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; CommandID : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; CommandName : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ParentCommandID : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ParentCommandName : LPWSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; SelectionIndex : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Location : UI_EVENTLOCATION (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; UI_EVENTPARAMS_COMMAND サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; CommandID : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; CommandName : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ParentCommandID : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ParentCommandName : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; SelectionIndex : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; Location : UI_EVENTLOCATION (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global UI_EVENTPARAMS_COMMAND
#field int CommandID
#field intptr CommandName
#field int ParentCommandID
#field intptr ParentCommandName
#field int SelectionIndex
#field int Location
#endstruct
stdim st, UI_EVENTPARAMS_COMMAND ; NSTRUCT 変数を確保
st->CommandID = 100
mes "CommandID=" + st->CommandID