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

POLYTEXTA

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

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

フィールド

フィールドサイズx64x86説明
xINT4+0+0テキストを描画する開始位置のX座標を論理単位で表す。
yINT4+4+4テキストを描画する開始位置のY座標を論理単位で表す。
nDWORD4+8+8lpstrが指す文字列の文字数を表す。
lpstrLPSTR8/4+16+12描画するANSI文字列へのポインタ。
uiFlagsDWORD4+24+16矩形の使用方法を指定するフラグ。ETO_OPAQUEやETO_CLIPPED等。
rclRECT16+28+20テキストの不透明描画またはクリッピングに使う矩形を表す。
pdxINT*8/4+48+36各文字間の送り幅を指定する配列へのポインタ。NULL可。

各言語での定義

#include <windows.h>

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

// POLYTEXTA  (x64 56 / x86 40 バイト)
typedef struct POLYTEXTA {
    INT x;
    INT y;
    DWORD n;
    LPSTR lpstr;
    DWORD uiFlags;
    RECT rcl;
    INT* pdx;
} POLYTEXTA;
using System;
using System.Runtime.InteropServices;

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POLYTEXTA
{
    public int x;
    public int y;
    public uint n;
    public IntPtr lpstr;
    public uint uiFlags;
    public RECT rcl;
    public IntPtr pdx;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    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 POLYTEXTA
    Public x As Integer
    Public y As Integer
    Public n As UInteger
    Public lpstr As IntPtr
    Public uiFlags As UInteger
    Public rcl As RECT
    Public pdx As IntPtr
End Structure
import ctypes
from ctypes import wintypes

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

class POLYTEXTA(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_int),
        ("y", ctypes.c_int),
        ("n", wintypes.DWORD),
        ("lpstr", ctypes.c_void_p),
        ("uiFlags", wintypes.DWORD),
        ("rcl", RECT),
        ("pdx", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct POLYTEXTA {
    pub x: i32,
    pub y: i32,
    pub n: u32,
    pub lpstr: *mut core::ffi::c_void,
    pub uiFlags: u32,
    pub rcl: RECT,
    pub pdx: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

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

type POLYTEXTA struct {
	x int32
	y int32
	n uint32
	lpstr uintptr
	uiFlags uint32
	rcl RECT
	pdx uintptr
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  POLYTEXTA = record
    x: Integer;
    y: Integer;
    n: DWORD;
    lpstr: Pointer;
    uiFlags: DWORD;
    rcl: RECT;
    pdx: Pointer;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const POLYTEXTA = extern struct {
    x: i32,
    y: i32,
    n: u32,
    lpstr: ?*anyopaque,
    uiFlags: u32,
    rcl: RECT,
    pdx: ?*anyopaque,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  POLYTEXTA {.bycopy.} = object
    x: int32
    y: int32
    n: uint32
    lpstr: pointer
    uiFlags: uint32
    rcl: RECT
    pdx: pointer
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct POLYTEXTA
{
    int x;
    int y;
    uint n;
    void* lpstr;
    uint uiFlags;
    RECT rcl;
    void* pdx;
}

HSP用 定義

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

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

#defstruct global POLYTEXTA
    #field int x
    #field int y
    #field int n
    #field intptr lpstr
    #field int uiFlags
    #field RECT rcl
    #field intptr pdx
#endstruct

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