SHChangeDWORDAsIDList
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cb | WORD | 2 | +0 | +0 | この構造体の有効サイズをバイト単位で表す。先頭の cbZero までの長さを示す。 |
| dwItem1 | DWORD | 4 | +2 | +2 | SHChangeNotify で渡す1つ目の DWORD イベントデータを格納する。 |
| dwItem2 | DWORD | 4 | +6 | +6 | SHChangeNotify で渡す2つ目の DWORD イベントデータを格納する。 |
| cbZero | WORD | 2 | +10 | +10 | PIDL の終端を示すゼロ終端マーカー。常に0が設定される。 |
各言語での定義
#include <windows.h>
// SHChangeDWORDAsIDList (x64 12 / x86 12 バイト)
#pragma pack(push, 1)
typedef struct SHChangeDWORDAsIDList {
WORD cb;
DWORD dwItem1;
DWORD dwItem2;
WORD cbZero;
} SHChangeDWORDAsIDList;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SHChangeDWORDAsIDList
{
public ushort cb;
public uint dwItem1;
public uint dwItem2;
public ushort cbZero;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SHChangeDWORDAsIDList
Public cb As UShort
Public dwItem1 As UInteger
Public dwItem2 As UInteger
Public cbZero As UShort
End Structureimport ctypes
from ctypes import wintypes
class SHChangeDWORDAsIDList(ctypes.Structure):
_pack_ = 1
_fields_ = [
("cb", ctypes.c_ushort),
("dwItem1", wintypes.DWORD),
("dwItem2", wintypes.DWORD),
("cbZero", ctypes.c_ushort),
]#[repr(C, packed(1))]
pub struct SHChangeDWORDAsIDList {
pub cb: u16,
pub dwItem1: u32,
pub dwItem2: u32,
pub cbZero: u16,
}import "golang.org/x/sys/windows"
type SHChangeDWORDAsIDList struct {
cb uint16
dwItem1 uint32
dwItem2 uint32
cbZero uint16
}type
SHChangeDWORDAsIDList = packed record
cb: Word;
dwItem1: DWORD;
dwItem2: DWORD;
cbZero: Word;
end;const SHChangeDWORDAsIDList = extern struct {
cb: u16,
dwItem1: u32,
dwItem2: u32,
cbZero: u16,
};type
SHChangeDWORDAsIDList {.packed.} = object
cb: uint16
dwItem1: uint32
dwItem2: uint32
cbZero: uint16align(1)
struct SHChangeDWORDAsIDList
{
ushort cb;
uint dwItem1;
uint dwItem2;
ushort cbZero;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SHChangeDWORDAsIDList サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; cb : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; dwItem1 : DWORD (+2, 4byte) lpoke st,2,値 / 値 = lpeek(st,2)
; dwItem2 : DWORD (+6, 4byte) lpoke st,6,値 / 値 = lpeek(st,6)
; cbZero : WORD (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SHChangeDWORDAsIDList, pack=1
#field short cb
#field int dwItem1
#field int dwItem2
#field short cbZero
#endstruct
stdim st, SHChangeDWORDAsIDList ; NSTRUCT 変数を確保
st->cb = 100
mes "cb=" + st->cb