ホーム › UI.Controls.RichEdit › PARAFORMAT
PARAFORMAT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | 本構造体のサイズをバイト単位で指定する。呼び出し前に設定する。 |
| dwMask | PARAFORMAT_MASK | 4 | +4 | +4 | 有効なメンバを示すマスクフラグ群である。PFM_系の組み合わせを指定する。 |
| wNumbering | PARAFORMAT_NUMBERING | 2 | +8 | +8 | 段落の番号付け種別を指定する。PFN_BULLET等の値を取る。 |
| Anonymous | _Anonymous_e__Union | 2 | +10 | +10 | wReserved等を含む無名共用体。予約領域として扱われる。 |
| dxStartIndent | INT | 4 | +12 | +12 | 段落の左インデントをtwips単位で指定する。 |
| dxRightIndent | INT | 4 | +16 | +16 | 段落の右インデントをtwips単位で指定する。 |
| dxOffset | INT | 4 | +20 | +20 | 2行目以降のぶら下げインデントをtwips単位で指定する。 |
| wAlignment | PARAFORMAT_ALIGNMENT | 2 | +24 | +24 | 段落の配置方法を指定する。PFA_LEFT等の値を取る。 |
| cTabCount | SHORT | 2 | +26 | +26 | rgxTabsに設定されたタブストップの個数である。 |
| rgxTabs | DWORD | 128 | +28 | +28 | 各タブストップ位置をtwips単位で格納する配列である。最大MAX_TAB_STOPS個。 |
共用体: _Anonymous_e__Union x64 2B / x86 2B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| wReserved | WORD | 2 | +0 | +0 |
| wEffects | WORD | 2 | +0 | +0 |
各言語での定義
#include <windows.h>
// PARAFORMAT (x64 156 / x86 156 バイト)
typedef struct PARAFORMAT {
DWORD cbSize;
PARAFORMAT_MASK dwMask;
PARAFORMAT_NUMBERING wNumbering;
_Anonymous_e__Union Anonymous;
INT dxStartIndent;
INT dxRightIndent;
INT dxOffset;
PARAFORMAT_ALIGNMENT wAlignment;
SHORT cTabCount;
DWORD rgxTabs[32];
} PARAFORMAT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PARAFORMAT
{
public uint cbSize;
public uint dwMask;
public ushort wNumbering;
public _Anonymous_e__Union Anonymous;
public int dxStartIndent;
public int dxRightIndent;
public int dxOffset;
public ushort wAlignment;
public short cTabCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public uint[] rgxTabs;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PARAFORMAT
Public cbSize As UInteger
Public dwMask As UInteger
Public wNumbering As UShort
Public Anonymous As _Anonymous_e__Union
Public dxStartIndent As Integer
Public dxRightIndent As Integer
Public dxOffset As Integer
Public wAlignment As UShort
Public cTabCount As Short
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public rgxTabs() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PARAFORMAT(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("dwMask", wintypes.DWORD),
("wNumbering", ctypes.c_ushort),
("Anonymous", _Anonymous_e__Union),
("dxStartIndent", ctypes.c_int),
("dxRightIndent", ctypes.c_int),
("dxOffset", ctypes.c_int),
("wAlignment", ctypes.c_ushort),
("cTabCount", ctypes.c_short),
("rgxTabs", wintypes.DWORD * 32),
]#[repr(C)]
pub struct PARAFORMAT {
pub cbSize: u32,
pub dwMask: u32,
pub wNumbering: u16,
pub Anonymous: _Anonymous_e__Union,
pub dxStartIndent: i32,
pub dxRightIndent: i32,
pub dxOffset: i32,
pub wAlignment: u16,
pub cTabCount: i16,
pub rgxTabs: [u32; 32],
}import "golang.org/x/sys/windows"
type PARAFORMAT struct {
cbSize uint32
dwMask uint32
wNumbering uint16
Anonymous _Anonymous_e__Union
dxStartIndent int32
dxRightIndent int32
dxOffset int32
wAlignment uint16
cTabCount int16
rgxTabs [32]uint32
}type
PARAFORMAT = record
cbSize: DWORD;
dwMask: DWORD;
wNumbering: Word;
Anonymous: _Anonymous_e__Union;
dxStartIndent: Integer;
dxRightIndent: Integer;
dxOffset: Integer;
wAlignment: Word;
cTabCount: Smallint;
rgxTabs: array[0..31] of DWORD;
end;const PARAFORMAT = extern struct {
cbSize: u32,
dwMask: u32,
wNumbering: u16,
Anonymous: _Anonymous_e__Union,
dxStartIndent: i32,
dxRightIndent: i32,
dxOffset: i32,
wAlignment: u16,
cTabCount: i16,
rgxTabs: [32]u32,
};type
PARAFORMAT {.bycopy.} = object
cbSize: uint32
dwMask: uint32
wNumbering: uint16
Anonymous: _Anonymous_e__Union
dxStartIndent: int32
dxRightIndent: int32
dxOffset: int32
wAlignment: uint16
cTabCount: int16
rgxTabs: array[32, uint32]struct PARAFORMAT
{
uint cbSize;
uint dwMask;
ushort wNumbering;
_Anonymous_e__Union Anonymous;
int dxStartIndent;
int dxRightIndent;
int dxOffset;
ushort wAlignment;
short cTabCount;
uint[32] rgxTabs;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PARAFORMAT サイズ: 156 バイト(x64)
dim st, 39 ; 4byte整数×39(構造体サイズ 156 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwMask : PARAFORMAT_MASK (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; wNumbering : PARAFORMAT_NUMBERING (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; Anonymous : _Anonymous_e__Union (+10, 2byte) varptr(st)+10 を基点に操作(2byte:入れ子/配列)
; dxStartIndent : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dxRightIndent : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dxOffset : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; wAlignment : PARAFORMAT_ALIGNMENT (+24, 2byte) wpoke st,24,値 / 値 = wpeek(st,24)
; cTabCount : SHORT (+26, 2byte) wpoke st,26,値 / 値 = wpeek(st,26)
; rgxTabs : DWORD (+28, 128byte) varptr(st)+28 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PARAFORMAT
#field int cbSize
#field int dwMask
#field short wNumbering
#field byte Anonymous 2
#field int dxStartIndent
#field int dxRightIndent
#field int dxOffset
#field short wAlignment
#field short cTabCount
#field int rgxTabs 32
#endstruct
stdim st, PARAFORMAT ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。