ホーム › Graphics.Printing › OPTTYPE
OPTTYPE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | WORD | 2 | +0 | +0 | 本構造体のサイズ(バイト単位)。 |
| Type | BYTE | 1 | +2 | +2 | オプション項目の型(チェックボックス・コンボ等)を示す値(TVOT_*)。 |
| Flags | BYTE | 1 | +3 | +3 | オプション型の動作を制御するビットフラグ。 |
| Count | WORD | 2 | +4 | +4 | pOptParam配列の要素数。 |
| BegCtrlID | WORD | 2 | +6 | +6 | この項目に割り当てるコントロールIDの開始値。 |
| pOptParam | OPTPARAM* | 8/4 | +8 | +8 | この型に属する各パラメータを表すOPTPARAM配列へのポインタ。 |
| Style | WORD | 2 | +16 | +12 | 項目の表示スタイルを示す値。 |
| wReserved | WORD | 6 | +18 | +14 | 予約フィールド。0を設定する。 |
| dwReserved | UINT_PTR | 24/12 | +24 | +20 | 予約フィールド。0を設定する。 |
各言語での定義
#include <windows.h>
// OPTTYPE (x64 48 / x86 32 バイト)
typedef struct OPTTYPE {
WORD cbSize;
BYTE Type;
BYTE Flags;
WORD Count;
WORD BegCtrlID;
OPTPARAM* pOptParam;
WORD Style;
WORD wReserved[3];
UINT_PTR dwReserved[3];
} OPTTYPE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OPTTYPE
{
public ushort cbSize;
public byte Type;
public byte Flags;
public ushort Count;
public ushort BegCtrlID;
public IntPtr pOptParam;
public ushort Style;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public ushort[] wReserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public UIntPtr[] dwReserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure OPTTYPE
Public cbSize As UShort
Public Type As Byte
Public Flags As Byte
Public Count As UShort
Public BegCtrlID As UShort
Public pOptParam As IntPtr
Public Style As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public wReserved() As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public dwReserved() As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class OPTTYPE(ctypes.Structure):
_fields_ = [
("cbSize", ctypes.c_ushort),
("Type", ctypes.c_ubyte),
("Flags", ctypes.c_ubyte),
("Count", ctypes.c_ushort),
("BegCtrlID", ctypes.c_ushort),
("pOptParam", ctypes.c_void_p),
("Style", ctypes.c_ushort),
("wReserved", ctypes.c_ushort * 3),
("dwReserved", ctypes.c_size_t * 3),
]#[repr(C)]
pub struct OPTTYPE {
pub cbSize: u16,
pub Type: u8,
pub Flags: u8,
pub Count: u16,
pub BegCtrlID: u16,
pub pOptParam: *mut core::ffi::c_void,
pub Style: u16,
pub wReserved: [u16; 3],
pub dwReserved: [usize; 3],
}import "golang.org/x/sys/windows"
type OPTTYPE struct {
cbSize uint16
Type byte
Flags byte
Count uint16
BegCtrlID uint16
pOptParam uintptr
Style uint16
wReserved [3]uint16
dwReserved [3]uintptr
}type
OPTTYPE = record
cbSize: Word;
Type: Byte;
Flags: Byte;
Count: Word;
BegCtrlID: Word;
pOptParam: Pointer;
Style: Word;
wReserved: array[0..2] of Word;
dwReserved: array[0..2] of NativeUInt;
end;const OPTTYPE = extern struct {
cbSize: u16,
Type: u8,
Flags: u8,
Count: u16,
BegCtrlID: u16,
pOptParam: ?*anyopaque,
Style: u16,
wReserved: [3]u16,
dwReserved: [3]usize,
};type
OPTTYPE {.bycopy.} = object
cbSize: uint16
Type: uint8
Flags: uint8
Count: uint16
BegCtrlID: uint16
pOptParam: pointer
Style: uint16
wReserved: array[3, uint16]
dwReserved: array[3, uint]struct OPTTYPE
{
ushort cbSize;
ubyte Type;
ubyte Flags;
ushort Count;
ushort BegCtrlID;
void* pOptParam;
ushort Style;
ushort[3] wReserved;
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 レイアウト)
; OPTTYPE サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; cbSize : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Type : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; Flags : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; Count : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; BegCtrlID : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; pOptParam : OPTPARAM* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; Style : WORD (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; wReserved : WORD (+14, 6byte) varptr(st)+14 を基点に操作(6byte:入れ子/配列)
; dwReserved : UINT_PTR (+20, 12byte) varptr(st)+20 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OPTTYPE サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbSize : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Type : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; Flags : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; Count : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; BegCtrlID : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; pOptParam : OPTPARAM* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; Style : WORD (+16, 2byte) wpoke st,16,値 / 値 = wpeek(st,16)
; wReserved : WORD (+18, 6byte) varptr(st)+18 を基点に操作(6byte:入れ子/配列)
; dwReserved : UINT_PTR (+24, 24byte) varptr(st)+24 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global OPTTYPE
#field short cbSize
#field byte Type
#field byte Flags
#field short Count
#field short BegCtrlID
#field intptr pOptParam
#field short Style
#field short wReserved 3
#field intptr dwReserved 3
#endstruct
stdim st, OPTTYPE ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize