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