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

MMC_TASK

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

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

フィールド

フィールドサイズx64x86説明
sDisplayObjectMMC_TASK_DISPLAY_OBJECT32/16+0+0タスクの表示オブジェクト(アイコン等)を保持する入れ子構造体。
szTextLPWSTR8/4+32+16タスクのタイトルテキスト。
szHelpStringLPWSTR8/4+40+20タスクの説明ヘルプテキスト。
eActionTypeMMC_ACTION_TYPE4+48+24タスク実行時の動作種別(コマンド/リンク等)を示す列挙値。
Anonymous_Anonymous_e__Union8/4+56+28動作種別に応じたアクションデータ(URL/コマンド)を保持する無名共用体。

共用体: _Anonymous_e__Union x64 8B / x86 4B

フィールドサイズx64x86
nCommandIDINT_PTR8/4+0+0
szActionURLLPWSTR8/4+0+0
szScriptLPWSTR8/4+0+0

各言語での定義

#include <windows.h>

// MMC_TASK_DISPLAY_OBJECT  (x64 32 / x86 16 バイト)
typedef struct MMC_TASK_DISPLAY_OBJECT {
    MMC_TASK_DISPLAY_TYPE eDisplayType;
    _Anonymous_e__Union Anonymous;
} MMC_TASK_DISPLAY_OBJECT;

// MMC_TASK  (x64 64 / x86 32 バイト)
typedef struct MMC_TASK {
    MMC_TASK_DISPLAY_OBJECT sDisplayObject;
    LPWSTR szText;
    LPWSTR szHelpString;
    MMC_ACTION_TYPE eActionType;
    _Anonymous_e__Union Anonymous;
} MMC_TASK;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MMC_TASK_DISPLAY_OBJECT
{
    public int eDisplayType;
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MMC_TASK
{
    public MMC_TASK_DISPLAY_OBJECT sDisplayObject;
    public IntPtr szText;
    public IntPtr szHelpString;
    public int eActionType;
    public _Anonymous_e__Union Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MMC_TASK_DISPLAY_OBJECT
    Public eDisplayType As Integer
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MMC_TASK
    Public sDisplayObject As MMC_TASK_DISPLAY_OBJECT
    Public szText As IntPtr
    Public szHelpString As IntPtr
    Public eActionType As Integer
    Public Anonymous As _Anonymous_e__Union
End Structure
import ctypes
from ctypes import wintypes

class MMC_TASK_DISPLAY_OBJECT(ctypes.Structure):
    _fields_ = [
        ("eDisplayType", ctypes.c_int),
        ("Anonymous", _Anonymous_e__Union),
    ]

class MMC_TASK(ctypes.Structure):
    _fields_ = [
        ("sDisplayObject", MMC_TASK_DISPLAY_OBJECT),
        ("szText", ctypes.c_void_p),
        ("szHelpString", ctypes.c_void_p),
        ("eActionType", ctypes.c_int),
        ("Anonymous", _Anonymous_e__Union),
    ]
#[repr(C)]
pub struct MMC_TASK_DISPLAY_OBJECT {
    pub eDisplayType: i32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct MMC_TASK {
    pub sDisplayObject: MMC_TASK_DISPLAY_OBJECT,
    pub szText: *mut core::ffi::c_void,
    pub szHelpString: *mut core::ffi::c_void,
    pub eActionType: i32,
    pub Anonymous: _Anonymous_e__Union,
}
import "golang.org/x/sys/windows"

type MMC_TASK_DISPLAY_OBJECT struct {
	eDisplayType int32
	Anonymous _Anonymous_e__Union
}

type MMC_TASK struct {
	sDisplayObject MMC_TASK_DISPLAY_OBJECT
	szText uintptr
	szHelpString uintptr
	eActionType int32
	Anonymous _Anonymous_e__Union
}
type
  MMC_TASK_DISPLAY_OBJECT = record
    eDisplayType: Integer;
    Anonymous: _Anonymous_e__Union;
  end;

  MMC_TASK = record
    sDisplayObject: MMC_TASK_DISPLAY_OBJECT;
    szText: Pointer;
    szHelpString: Pointer;
    eActionType: Integer;
    Anonymous: _Anonymous_e__Union;
  end;
const MMC_TASK_DISPLAY_OBJECT = extern struct {
    eDisplayType: i32,
    Anonymous: _Anonymous_e__Union,
};

const MMC_TASK = extern struct {
    sDisplayObject: MMC_TASK_DISPLAY_OBJECT,
    szText: ?*anyopaque,
    szHelpString: ?*anyopaque,
    eActionType: i32,
    Anonymous: _Anonymous_e__Union,
};
type
  MMC_TASK_DISPLAY_OBJECT {.bycopy.} = object
    eDisplayType: int32
    Anonymous: _Anonymous_e__Union

  MMC_TASK {.bycopy.} = object
    sDisplayObject: MMC_TASK_DISPLAY_OBJECT
    szText: pointer
    szHelpString: pointer
    eActionType: int32
    Anonymous: _Anonymous_e__Union
struct MMC_TASK_DISPLAY_OBJECT
{
    int eDisplayType;
    _Anonymous_e__Union Anonymous;
}

struct MMC_TASK
{
    MMC_TASK_DISPLAY_OBJECT sDisplayObject;
    void* szText;
    void* szHelpString;
    int eActionType;
    _Anonymous_e__Union Anonymous;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MMC_TASK サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; sDisplayObject : MMC_TASK_DISPLAY_OBJECT (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; szText : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; szHelpString : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; eActionType : MMC_ACTION_TYPE (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+28, 4byte)  varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MMC_TASK サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; sDisplayObject : MMC_TASK_DISPLAY_OBJECT (+0, 32byte)  varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; szText : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; szHelpString : LPWSTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; eActionType : MMC_ACTION_TYPE (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MMC_TASK_DISPLAY_OBJECT
    #field int eDisplayType
    #field byte Anonymous 24
#endstruct

#defstruct global MMC_TASK
    #field MMC_TASK_DISPLAY_OBJECT sDisplayObject
    #field intptr szText
    #field intptr szHelpString
    #field int eActionType
    #field byte Anonymous 8
#endstruct

stdim st, MMC_TASK        ; NSTRUCT 変数を確保
st->eActionType = 100
mes "eActionType=" + st->eActionType
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。