Win32 API 日本語リファレンス
ホームSystem.Mmc › MMCBUTTON

MMCBUTTON

構造体
サイズx64: 32 バイト / x86: 20 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
nBitmapINT4+0+0ツールバーボタンに使用するビットマップのインデックス。
idCommandINT4+4+4ボタン押下時に送られるコマンドID。
fsStateBYTE1+8+8ボタンの状態フラグ(有効/押下等)。
fsTypeBYTE1+9+9ボタンの種類フラグ(標準/区切り等)。
lpButtonTextLPWSTR8/4+16+12ボタンに表示するテキスト。
lpTooltipTextLPWSTR8/4+24+16ボタンのツールチップテキスト。

各言語での定義

#include <windows.h>

// MMCBUTTON  (x64 32 / x86 20 バイト)
typedef struct MMCBUTTON {
    INT nBitmap;
    INT idCommand;
    BYTE fsState;
    BYTE fsType;
    LPWSTR lpButtonText;
    LPWSTR lpTooltipText;
} MMCBUTTON;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MMCBUTTON
{
    public int nBitmap;
    public int idCommand;
    public byte fsState;
    public byte fsType;
    public IntPtr lpButtonText;
    public IntPtr lpTooltipText;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MMCBUTTON
    Public nBitmap As Integer
    Public idCommand As Integer
    Public fsState As Byte
    Public fsType As Byte
    Public lpButtonText As IntPtr
    Public lpTooltipText As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class MMCBUTTON(ctypes.Structure):
    _fields_ = [
        ("nBitmap", ctypes.c_int),
        ("idCommand", ctypes.c_int),
        ("fsState", ctypes.c_ubyte),
        ("fsType", ctypes.c_ubyte),
        ("lpButtonText", ctypes.c_void_p),
        ("lpTooltipText", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct MMCBUTTON {
    pub nBitmap: i32,
    pub idCommand: i32,
    pub fsState: u8,
    pub fsType: u8,
    pub lpButtonText: *mut core::ffi::c_void,
    pub lpTooltipText: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type MMCBUTTON struct {
	nBitmap int32
	idCommand int32
	fsState byte
	fsType byte
	lpButtonText uintptr
	lpTooltipText uintptr
}
type
  MMCBUTTON = record
    nBitmap: Integer;
    idCommand: Integer;
    fsState: Byte;
    fsType: Byte;
    lpButtonText: Pointer;
    lpTooltipText: Pointer;
  end;
const MMCBUTTON = extern struct {
    nBitmap: i32,
    idCommand: i32,
    fsState: u8,
    fsType: u8,
    lpButtonText: ?*anyopaque,
    lpTooltipText: ?*anyopaque,
};
type
  MMCBUTTON {.bycopy.} = object
    nBitmap: int32
    idCommand: int32
    fsState: uint8
    fsType: uint8
    lpButtonText: pointer
    lpTooltipText: pointer
struct MMCBUTTON
{
    int nBitmap;
    int idCommand;
    ubyte fsState;
    ubyte fsType;
    void* lpButtonText;
    void* lpTooltipText;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MMCBUTTON サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; nBitmap : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; idCommand : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; fsState : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; fsType : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; lpButtonText : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lpTooltipText : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MMCBUTTON サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; nBitmap : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; idCommand : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; fsState : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; fsType : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; lpButtonText : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; lpTooltipText : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MMCBUTTON
    #field int nBitmap
    #field int idCommand
    #field byte fsState
    #field byte fsType
    #field intptr lpButtonText
    #field intptr lpTooltipText
#endstruct

stdim st, MMCBUTTON        ; NSTRUCT 変数を確保
st->nBitmap = 100
mes "nBitmap=" + st->nBitmap