Win32 API 日本語リファレンス
ホームUI.Shell › DELEGATEITEMID

DELEGATEITEMID

構造体
サイズx64: 7 バイト / x86: 7 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
cbSizeWORD2+0+0この委任アイテムID全体のバイトサイズ。
wOuterWORD2+2+2外側(ホスト)が使う識別データ。
cbInnerWORD2+4+4内側(委任先)のデータ部分のバイトサイズ。
rgbBYTE1+6+6委任先固有の可変長データバイト列。

各言語での定義

#include <windows.h>

// DELEGATEITEMID  (x64 7 / x86 7 バイト)
#pragma pack(push, 1)
typedef struct DELEGATEITEMID {
    WORD cbSize;
    WORD wOuter;
    WORD cbInner;
    BYTE rgb[1];
} DELEGATEITEMID;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DELEGATEITEMID
{
    public ushort cbSize;
    public ushort wOuter;
    public ushort cbInner;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] rgb;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DELEGATEITEMID
    Public cbSize As UShort
    Public wOuter As UShort
    Public cbInner As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public rgb() As Byte
End Structure
import ctypes
from ctypes import wintypes

class DELEGATEITEMID(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("cbSize", ctypes.c_ushort),
        ("wOuter", ctypes.c_ushort),
        ("cbInner", ctypes.c_ushort),
        ("rgb", ctypes.c_ubyte * 1),
    ]
#[repr(C, packed(1))]
pub struct DELEGATEITEMID {
    pub cbSize: u16,
    pub wOuter: u16,
    pub cbInner: u16,
    pub rgb: [u8; 1],
}
import "golang.org/x/sys/windows"

type DELEGATEITEMID struct {
	cbSize uint16
	wOuter uint16
	cbInner uint16
	rgb [1]byte
}
type
  DELEGATEITEMID = packed record
    cbSize: Word;
    wOuter: Word;
    cbInner: Word;
    rgb: array[0..0] of Byte;
  end;
const DELEGATEITEMID = extern struct {
    cbSize: u16,
    wOuter: u16,
    cbInner: u16,
    rgb: [1]u8,
};
type
  DELEGATEITEMID {.packed.} = object
    cbSize: uint16
    wOuter: uint16
    cbInner: uint16
    rgb: array[1, uint8]
align(1)
struct DELEGATEITEMID
{
    ushort cbSize;
    ushort wOuter;
    ushort cbInner;
    ubyte[1] rgb;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DELEGATEITEMID サイズ: 7 バイト(x64)
dim st, 2    ; 4byte整数×2(構造体サイズ 7 / 4 切り上げ)
; cbSize : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; wOuter : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; cbInner : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; rgb : BYTE (+6, 1byte)  varptr(st)+6 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DELEGATEITEMID, pack=1
    #field short cbSize
    #field short wOuter
    #field short cbInner
    #field byte rgb 1
#endstruct

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