ホーム › Graphics.Printing › OPTITEM
OPTITEM
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | WORD | 2 | +0 | +0 | 本構造体のサイズ(バイト単位)。 |
| Level | BYTE | 1 | +2 | +2 | ツリー表示時の階層レベル。インデント深さを表す。 |
| DlgPageIdx | BYTE | 1 | +3 | +3 | この項目が属するダイアログページのインデックス。 |
| Flags | DWORD | 4 | +4 | +4 | オプション項目の状態・動作を制御するビットフラグ。 |
| UserData | UINT_PTR | 8/4 | +8 | +8 | アプリケーション定義のユーザーデータ。 |
| pName | CHAR* | 8/4 | +16 | +12 | 項目のラベル文字列へのポインタ。 |
| Anonymous1 | _Anonymous1_e__Union | 8/4 | +24 | +16 | 選択値(Sel)等を保持する無名共用体。 |
| Anonymous2 | _Anonymous2_e__Union | 8/4 | +32 | +20 | 拡張チェックボックス情報等を保持する無名共用体。 |
| pOptType | OPTTYPE* | 8/4 | +40 | +24 | この項目の型情報を示すOPTTYPE構造体へのポインタ。 |
| HelpIndex | DWORD | 4 | +48 | +28 | ヘルプトピックのインデックス。 |
| DMPubID | BYTE | 1 | +52 | +32 | 対応するDEVMODE公開設定の識別子(DMPUB_*)。 |
| UserItemID | BYTE | 1 | +53 | +33 | アプリケーション定義の項目ID。 |
| wReserved | WORD | 2 | +54 | +34 | 予約フィールド。0を設定する。 |
| pOIExt | OIEXT* | 8/4 | +56 | +36 | 拡張情報を示すOIEXT構造体へのポインタ。NULL可。 |
| dwReserved | UINT_PTR | 24/12 | +64 | +40 | 予約フィールド。0を設定する。 |
共用体: _Anonymous1_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Sel | INT | 4 | +0 | +0 |
| pSel | CHAR* | 8/4 | +0 | +0 |
共用体: _Anonymous2_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| pExtChkBox | EXTCHKBOX* | 8/4 | +0 | +0 |
| pExtPush | EXTPUSH* | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// OPTITEM (x64 88 / x86 52 バイト)
typedef struct OPTITEM {
WORD cbSize;
BYTE Level;
BYTE DlgPageIdx;
DWORD Flags;
UINT_PTR UserData;
CHAR* pName;
_Anonymous1_e__Union Anonymous1;
_Anonymous2_e__Union Anonymous2;
OPTTYPE* pOptType;
DWORD HelpIndex;
BYTE DMPubID;
BYTE UserItemID;
WORD wReserved;
OIEXT* pOIExt;
UINT_PTR dwReserved[3];
} OPTITEM;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OPTITEM
{
public ushort cbSize;
public byte Level;
public byte DlgPageIdx;
public uint Flags;
public UIntPtr UserData;
public IntPtr pName;
public _Anonymous1_e__Union Anonymous1;
public _Anonymous2_e__Union Anonymous2;
public IntPtr pOptType;
public uint HelpIndex;
public byte DMPubID;
public byte UserItemID;
public ushort wReserved;
public IntPtr pOIExt;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public UIntPtr[] dwReserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure OPTITEM
Public cbSize As UShort
Public Level As Byte
Public DlgPageIdx As Byte
Public Flags As UInteger
Public UserData As UIntPtr
Public pName As IntPtr
Public Anonymous1 As _Anonymous1_e__Union
Public Anonymous2 As _Anonymous2_e__Union
Public pOptType As IntPtr
Public HelpIndex As UInteger
Public DMPubID As Byte
Public UserItemID As Byte
Public wReserved As UShort
Public pOIExt As IntPtr
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public dwReserved() As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class OPTITEM(ctypes.Structure):
_fields_ = [
("cbSize", ctypes.c_ushort),
("Level", ctypes.c_ubyte),
("DlgPageIdx", ctypes.c_ubyte),
("Flags", wintypes.DWORD),
("UserData", ctypes.c_size_t),
("pName", ctypes.c_void_p),
("Anonymous1", _Anonymous1_e__Union),
("Anonymous2", _Anonymous2_e__Union),
("pOptType", ctypes.c_void_p),
("HelpIndex", wintypes.DWORD),
("DMPubID", ctypes.c_ubyte),
("UserItemID", ctypes.c_ubyte),
("wReserved", ctypes.c_ushort),
("pOIExt", ctypes.c_void_p),
("dwReserved", ctypes.c_size_t * 3),
]#[repr(C)]
pub struct OPTITEM {
pub cbSize: u16,
pub Level: u8,
pub DlgPageIdx: u8,
pub Flags: u32,
pub UserData: usize,
pub pName: *mut core::ffi::c_void,
pub Anonymous1: _Anonymous1_e__Union,
pub Anonymous2: _Anonymous2_e__Union,
pub pOptType: *mut core::ffi::c_void,
pub HelpIndex: u32,
pub DMPubID: u8,
pub UserItemID: u8,
pub wReserved: u16,
pub pOIExt: *mut core::ffi::c_void,
pub dwReserved: [usize; 3],
}import "golang.org/x/sys/windows"
type OPTITEM struct {
cbSize uint16
Level byte
DlgPageIdx byte
Flags uint32
UserData uintptr
pName uintptr
Anonymous1 _Anonymous1_e__Union
Anonymous2 _Anonymous2_e__Union
pOptType uintptr
HelpIndex uint32
DMPubID byte
UserItemID byte
wReserved uint16
pOIExt uintptr
dwReserved [3]uintptr
}type
OPTITEM = record
cbSize: Word;
Level: Byte;
DlgPageIdx: Byte;
Flags: DWORD;
UserData: NativeUInt;
pName: Pointer;
Anonymous1: _Anonymous1_e__Union;
Anonymous2: _Anonymous2_e__Union;
pOptType: Pointer;
HelpIndex: DWORD;
DMPubID: Byte;
UserItemID: Byte;
wReserved: Word;
pOIExt: Pointer;
dwReserved: array[0..2] of NativeUInt;
end;const OPTITEM = extern struct {
cbSize: u16,
Level: u8,
DlgPageIdx: u8,
Flags: u32,
UserData: usize,
pName: ?*anyopaque,
Anonymous1: _Anonymous1_e__Union,
Anonymous2: _Anonymous2_e__Union,
pOptType: ?*anyopaque,
HelpIndex: u32,
DMPubID: u8,
UserItemID: u8,
wReserved: u16,
pOIExt: ?*anyopaque,
dwReserved: [3]usize,
};type
OPTITEM {.bycopy.} = object
cbSize: uint16
Level: uint8
DlgPageIdx: uint8
Flags: uint32
UserData: uint
pName: pointer
Anonymous1: _Anonymous1_e__Union
Anonymous2: _Anonymous2_e__Union
pOptType: pointer
HelpIndex: uint32
DMPubID: uint8
UserItemID: uint8
wReserved: uint16
pOIExt: pointer
dwReserved: array[3, uint]struct OPTITEM
{
ushort cbSize;
ubyte Level;
ubyte DlgPageIdx;
uint Flags;
size_t UserData;
void* pName;
_Anonymous1_e__Union Anonymous1;
_Anonymous2_e__Union Anonymous2;
void* pOptType;
uint HelpIndex;
ubyte DMPubID;
ubyte UserItemID;
ushort wReserved;
void* pOIExt;
size_t[3] dwReserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; OPTITEM サイズ: 52 バイト(x86)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; cbSize : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Level : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; DlgPageIdx : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; Flags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; UserData : UINT_PTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; pName : CHAR* (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Anonymous1 : _Anonymous1_e__Union (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; Anonymous2 : _Anonymous2_e__Union (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; pOptType : OPTTYPE* (+24, 4byte) varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; HelpIndex : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; DMPubID : BYTE (+32, 1byte) poke st,32,値 / 値 = peek(st,32)
; UserItemID : BYTE (+33, 1byte) poke st,33,値 / 値 = peek(st,33)
; wReserved : WORD (+34, 2byte) wpoke st,34,値 / 値 = wpeek(st,34)
; pOIExt : OIEXT* (+36, 4byte) varptr(st)+36 を基点に操作(4byte:入れ子/配列)
; dwReserved : UINT_PTR (+40, 12byte) varptr(st)+40 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OPTITEM サイズ: 88 バイト(x64)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; cbSize : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Level : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; DlgPageIdx : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; Flags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; UserData : UINT_PTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pName : CHAR* (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Anonymous1 : _Anonymous1_e__Union (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; Anonymous2 : _Anonymous2_e__Union (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; pOptType : OPTTYPE* (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; HelpIndex : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; DMPubID : BYTE (+52, 1byte) poke st,52,値 / 値 = peek(st,52)
; UserItemID : BYTE (+53, 1byte) poke st,53,値 / 値 = peek(st,53)
; wReserved : WORD (+54, 2byte) wpoke st,54,値 / 値 = wpeek(st,54)
; pOIExt : OIEXT* (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; dwReserved : UINT_PTR (+64, 24byte) varptr(st)+64 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global OPTITEM
#field short cbSize
#field byte Level
#field byte DlgPageIdx
#field int Flags
#field intptr UserData
#field intptr pName
#field byte Anonymous1 8
#field byte Anonymous2 8
#field intptr pOptType
#field int HelpIndex
#field byte DMPubID
#field byte UserItemID
#field short wReserved
#field intptr pOIExt
#field intptr dwReserved 3
#endstruct
stdim st, OPTITEM ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。