Win32 API 日本語リファレンス
ホームGraphics.Printing › FORM_INFO_1A

FORM_INFO_1A

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

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

フィールド

フィールドサイズx64x86説明
FlagsDWORD4+0+0用紙(フォーム)の種別を示すビットフラグ(FORM_USER/FORM_BUILTIN等)。
pNameLPSTR8/4+8+4フォーム名(ANSI)へのポインタ。
SizeSIZE8+16+8用紙の寸法を示すSIZE(マイクロメートル単位)。
ImageableAreaRECTL16+24+16印刷可能領域を示すRECTL(マイクロメートル単位)。

各言語での定義

#include <windows.h>

// SIZE  (x64 8 / x86 8 バイト)
typedef struct SIZE {
    INT cx;
    INT cy;
} SIZE;

// RECTL  (x64 16 / x86 16 バイト)
typedef struct RECTL {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECTL;

// FORM_INFO_1A  (x64 40 / x86 32 バイト)
typedef struct FORM_INFO_1A {
    DWORD Flags;
    LPSTR pName;
    SIZE Size;
    RECTL ImageableArea;
} FORM_INFO_1A;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIZE
{
    public int cx;
    public int cy;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECTL
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FORM_INFO_1A
{
    public uint Flags;
    public IntPtr pName;
    public SIZE Size;
    public RECTL ImageableArea;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIZE
    Public cx As Integer
    Public cy As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECTL
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FORM_INFO_1A
    Public Flags As UInteger
    Public pName As IntPtr
    Public Size As SIZE
    Public ImageableArea As RECTL
End Structure
import ctypes
from ctypes import wintypes

class SIZE(ctypes.Structure):
    _fields_ = [
        ("cx", ctypes.c_int),
        ("cy", ctypes.c_int),
    ]

class RECTL(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class FORM_INFO_1A(ctypes.Structure):
    _fields_ = [
        ("Flags", wintypes.DWORD),
        ("pName", ctypes.c_void_p),
        ("Size", SIZE),
        ("ImageableArea", RECTL),
    ]
#[repr(C)]
pub struct SIZE {
    pub cx: i32,
    pub cy: i32,
}

#[repr(C)]
pub struct RECTL {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct FORM_INFO_1A {
    pub Flags: u32,
    pub pName: *mut core::ffi::c_void,
    pub Size: SIZE,
    pub ImageableArea: RECTL,
}
import "golang.org/x/sys/windows"

type SIZE struct {
	cx int32
	cy int32
}

type RECTL struct {
	left int32
	top int32
	right int32
	bottom int32
}

type FORM_INFO_1A struct {
	Flags uint32
	pName uintptr
	Size SIZE
	ImageableArea RECTL
}
type
  SIZE = record
    cx: Integer;
    cy: Integer;
  end;

  RECTL = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  FORM_INFO_1A = record
    Flags: DWORD;
    pName: Pointer;
    Size: SIZE;
    ImageableArea: RECTL;
  end;
const SIZE = extern struct {
    cx: i32,
    cy: i32,
};

const RECTL = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const FORM_INFO_1A = extern struct {
    Flags: u32,
    pName: ?*anyopaque,
    Size: SIZE,
    ImageableArea: RECTL,
};
type
  SIZE {.bycopy.} = object
    cx: int32
    cy: int32

  RECTL {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  FORM_INFO_1A {.bycopy.} = object
    Flags: uint32
    pName: pointer
    Size: SIZE
    ImageableArea: RECTL
struct SIZE
{
    int cx;
    int cy;
}

struct RECTL
{
    int left;
    int top;
    int right;
    int bottom;
}

struct FORM_INFO_1A
{
    uint Flags;
    void* pName;
    SIZE Size;
    RECTL ImageableArea;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; FORM_INFO_1A サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Flags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pName : LPSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Size : SIZE (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ImageableArea : RECTL (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FORM_INFO_1A サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Flags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pName : LPSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Size : SIZE (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ImageableArea : RECTL (+24, 16byte)  varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SIZE
    #field int cx
    #field int cy
#endstruct

#defstruct global RECTL
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global FORM_INFO_1A
    #field int Flags
    #field intptr pName
    #field SIZE Size
    #field RECTL ImageableArea
#endstruct

stdim st, FORM_INFO_1A        ; NSTRUCT 変数を確保
st->Flags = 100
mes "Flags=" + st->Flags