Win32 API 日本語リファレンス
ホームDevices.Display › LIGATURE

LIGATURE

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

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

フィールド

フィールドサイズx64x86説明
culSizeDWORD4+0+0この構造体のバイトサイズ。
pwszLPWSTR8/4+8+4合字を構成する文字列(Unicode)へのポインタ。
chglyphDWORD4+16+8合字を構成するグリフ数。
ahglyphDWORD4+20+12合字を構成するグリフハンドル配列(可変長)。

各言語での定義

#include <windows.h>

// LIGATURE  (x64 24 / x86 16 バイト)
typedef struct LIGATURE {
    DWORD culSize;
    LPWSTR pwsz;
    DWORD chglyph;
    DWORD ahglyph[1];
} LIGATURE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LIGATURE
{
    public uint culSize;
    public IntPtr pwsz;
    public uint chglyph;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] ahglyph;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LIGATURE
    Public culSize As UInteger
    Public pwsz As IntPtr
    Public chglyph As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ahglyph() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class LIGATURE(ctypes.Structure):
    _fields_ = [
        ("culSize", wintypes.DWORD),
        ("pwsz", ctypes.c_void_p),
        ("chglyph", wintypes.DWORD),
        ("ahglyph", wintypes.DWORD * 1),
    ]
#[repr(C)]
pub struct LIGATURE {
    pub culSize: u32,
    pub pwsz: *mut core::ffi::c_void,
    pub chglyph: u32,
    pub ahglyph: [u32; 1],
}
import "golang.org/x/sys/windows"

type LIGATURE struct {
	culSize uint32
	pwsz uintptr
	chglyph uint32
	ahglyph [1]uint32
}
type
  LIGATURE = record
    culSize: DWORD;
    pwsz: Pointer;
    chglyph: DWORD;
    ahglyph: array[0..0] of DWORD;
  end;
const LIGATURE = extern struct {
    culSize: u32,
    pwsz: ?*anyopaque,
    chglyph: u32,
    ahglyph: [1]u32,
};
type
  LIGATURE {.bycopy.} = object
    culSize: uint32
    pwsz: pointer
    chglyph: uint32
    ahglyph: array[1, uint32]
struct LIGATURE
{
    uint culSize;
    void* pwsz;
    uint chglyph;
    uint[1] ahglyph;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; LIGATURE サイズ: 16 バイト(x86)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; culSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pwsz : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; chglyph : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ahglyph : DWORD (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LIGATURE サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; culSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pwsz : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; chglyph : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ahglyph : DWORD (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global LIGATURE
    #field int culSize
    #field intptr pwsz
    #field int chglyph
    #field int ahglyph 1
#endstruct

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