ホーム › Devices.Display › STROBJ
STROBJ
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cGlyphs | DWORD | 4 | +0 | +0 | 文字列に含まれるグリフ数。 |
| flAccel | DWORD | 4 | +4 | +4 | アクセラレーションフラグ(SO_*、固定ピッチ等)。 |
| ulCharInc | DWORD | 4 | +8 | +8 | 固定ピッチ時の文字送り量。 |
| rclBkGround | RECTL | 16 | +12 | +12 | 背景矩形(RECTL)。不透明描画領域。 |
| pgp | GLYPHPOS* | 8/4 | +32 | +28 | グリフ位置情報(GLYPHPOS)配列へのポインタ。 |
| pwszOrg | LPWSTR | 8/4 | +40 | +32 | 元の文字列(Unicode)へのポインタ。 |
各言語での定義
#include <windows.h>
// RECTL (x64 16 / x86 16 バイト)
typedef struct RECTL {
INT left;
INT top;
INT right;
INT bottom;
} RECTL;
// STROBJ (x64 48 / x86 36 バイト)
typedef struct STROBJ {
DWORD cGlyphs;
DWORD flAccel;
DWORD ulCharInc;
RECTL rclBkGround;
GLYPHPOS* pgp;
LPWSTR pwszOrg;
} STROBJ;using System;
using System.Runtime.InteropServices;
[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 STROBJ
{
public uint cGlyphs;
public uint flAccel;
public uint ulCharInc;
public RECTL rclBkGround;
public IntPtr pgp;
public IntPtr pwszOrg;
}Imports System.Runtime.InteropServices
<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 STROBJ
Public cGlyphs As UInteger
Public flAccel As UInteger
Public ulCharInc As UInteger
Public rclBkGround As RECTL
Public pgp As IntPtr
Public pwszOrg As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class RECTL(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class STROBJ(ctypes.Structure):
_fields_ = [
("cGlyphs", wintypes.DWORD),
("flAccel", wintypes.DWORD),
("ulCharInc", wintypes.DWORD),
("rclBkGround", RECTL),
("pgp", ctypes.c_void_p),
("pwszOrg", ctypes.c_void_p),
]#[repr(C)]
pub struct RECTL {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct STROBJ {
pub cGlyphs: u32,
pub flAccel: u32,
pub ulCharInc: u32,
pub rclBkGround: RECTL,
pub pgp: *mut core::ffi::c_void,
pub pwszOrg: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type RECTL struct {
left int32
top int32
right int32
bottom int32
}
type STROBJ struct {
cGlyphs uint32
flAccel uint32
ulCharInc uint32
rclBkGround RECTL
pgp uintptr
pwszOrg uintptr
}type
RECTL = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
STROBJ = record
cGlyphs: DWORD;
flAccel: DWORD;
ulCharInc: DWORD;
rclBkGround: RECTL;
pgp: Pointer;
pwszOrg: Pointer;
end;const RECTL = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const STROBJ = extern struct {
cGlyphs: u32,
flAccel: u32,
ulCharInc: u32,
rclBkGround: RECTL,
pgp: ?*anyopaque,
pwszOrg: ?*anyopaque,
};type
RECTL {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
STROBJ {.bycopy.} = object
cGlyphs: uint32
flAccel: uint32
ulCharInc: uint32
rclBkGround: RECTL
pgp: pointer
pwszOrg: pointerstruct RECTL
{
int left;
int top;
int right;
int bottom;
}
struct STROBJ
{
uint cGlyphs;
uint flAccel;
uint ulCharInc;
RECTL rclBkGround;
void* pgp;
void* pwszOrg;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STROBJ サイズ: 36 バイト(x86)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; cGlyphs : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; flAccel : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ulCharInc : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; rclBkGround : RECTL (+12, 16byte) varptr(st)+12 を基点に操作(16byte:入れ子/配列)
; pgp : GLYPHPOS* (+28, 4byte) varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; pwszOrg : LPWSTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STROBJ サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cGlyphs : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; flAccel : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ulCharInc : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; rclBkGround : RECTL (+12, 16byte) varptr(st)+12 を基点に操作(16byte:入れ子/配列)
; pgp : GLYPHPOS* (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; pwszOrg : LPWSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECTL
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global STROBJ
#field int cGlyphs
#field int flAccel
#field int ulCharInc
#field RECTL rclBkGround
#field intptr pgp
#field intptr pwszOrg
#endstruct
stdim st, STROBJ ; NSTRUCT 変数を確保
st->cGlyphs = 100
mes "cGlyphs=" + st->cGlyphs