Win32 API 日本語リファレンス
ホームUI.Controls.RichEdit › PARAFORMAT

PARAFORMAT

構造体
サイズx64: 156 バイト / x86: 156 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0本構造体のサイズをバイト単位で指定する。呼び出し前に設定する。
dwMaskPARAFORMAT_MASK4+4+4有効なメンバを示すマスクフラグ群である。PFM_系の組み合わせを指定する。
wNumberingPARAFORMAT_NUMBERING2+8+8段落の番号付け種別を指定する。PFN_BULLET等の値を取る。
Anonymous_Anonymous_e__Union2+10+10wReserved等を含む無名共用体。予約領域として扱われる。
dxStartIndentINT4+12+12段落の左インデントをtwips単位で指定する。
dxRightIndentINT4+16+16段落の右インデントをtwips単位で指定する。
dxOffsetINT4+20+202行目以降のぶら下げインデントをtwips単位で指定する。
wAlignmentPARAFORMAT_ALIGNMENT2+24+24段落の配置方法を指定する。PFA_LEFT等の値を取る。
cTabCountSHORT2+26+26rgxTabsに設定されたタブストップの個数である。
rgxTabsDWORD128+28+28各タブストップ位置をtwips単位で格納する配列である。最大MAX_TAB_STOPS個。

共用体: _Anonymous_e__Union x64 2B / x86 2B

フィールドサイズx64x86
wReservedWORD2+0+0
wEffectsWORD2+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 Structure
import 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 非対応)。必要に応じ手動でアクセス。