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

RICHEDIT_IMAGE_PARAMETERS

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

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

フィールド

フィールドサイズx64x86説明
xWidthINT4+0+0画像の幅 (HIMETRIC 単位、0.01 mm) です。
yHeightINT4+4+4画像の高さ(himetric単位)。
AscentINT4+8+8TypeTA_BASELINE の場合、このパラメーターは画像の上端がテキストのベースラインより上に伸びる距離 (HIMETRIC 単位) です。TypeTA_BASELINE で、ascent が 0 の場合、画像の下端がテキストのベースラインに配置されます。
TypeINT4+12+12

画像の垂直方向の配置です。次のいずれかの値を指定できます。

意味
TA_BASELINE
画像をテキストのベースラインを基準に配置します。
TA_BOTTOM
画像の下端をテキスト行の下端に合わせて配置します。
TA_TOP
画像の上端をテキスト行の上端に合わせて配置します
pwszAlternateTextLPWSTR8/4+16+16画像の代替テキストです。
pIStreamIStream*8/4+24+20

画像データを格納するストリームです。

- xHeight

画像の高さ (HIMETRIC 単位) です。

公式ドキュメント

EM_INSERTIMAGE メッセージによって挿入される画像の属性を定義します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// RICHEDIT_IMAGE_PARAMETERS  (x64 32 / x86 24 バイト)
typedef struct RICHEDIT_IMAGE_PARAMETERS {
    INT xWidth;
    INT yHeight;
    INT Ascent;
    INT Type;
    LPWSTR pwszAlternateText;
    IStream* pIStream;
} RICHEDIT_IMAGE_PARAMETERS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RICHEDIT_IMAGE_PARAMETERS
{
    public int xWidth;
    public int yHeight;
    public int Ascent;
    public int Type;
    public IntPtr pwszAlternateText;
    public IntPtr pIStream;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RICHEDIT_IMAGE_PARAMETERS
    Public xWidth As Integer
    Public yHeight As Integer
    Public Ascent As Integer
    Public Type As Integer
    Public pwszAlternateText As IntPtr
    Public pIStream As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class RICHEDIT_IMAGE_PARAMETERS(ctypes.Structure):
    _fields_ = [
        ("xWidth", ctypes.c_int),
        ("yHeight", ctypes.c_int),
        ("Ascent", ctypes.c_int),
        ("Type", ctypes.c_int),
        ("pwszAlternateText", ctypes.c_void_p),
        ("pIStream", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct RICHEDIT_IMAGE_PARAMETERS {
    pub xWidth: i32,
    pub yHeight: i32,
    pub Ascent: i32,
    pub Type: i32,
    pub pwszAlternateText: *mut core::ffi::c_void,
    pub pIStream: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type RICHEDIT_IMAGE_PARAMETERS struct {
	xWidth int32
	yHeight int32
	Ascent int32
	Type int32
	pwszAlternateText uintptr
	pIStream uintptr
}
type
  RICHEDIT_IMAGE_PARAMETERS = record
    xWidth: Integer;
    yHeight: Integer;
    Ascent: Integer;
    Type: Integer;
    pwszAlternateText: Pointer;
    pIStream: Pointer;
  end;
const RICHEDIT_IMAGE_PARAMETERS = extern struct {
    xWidth: i32,
    yHeight: i32,
    Ascent: i32,
    Type: i32,
    pwszAlternateText: ?*anyopaque,
    pIStream: ?*anyopaque,
};
type
  RICHEDIT_IMAGE_PARAMETERS {.bycopy.} = object
    xWidth: int32
    yHeight: int32
    Ascent: int32
    Type: int32
    pwszAlternateText: pointer
    pIStream: pointer
struct RICHEDIT_IMAGE_PARAMETERS
{
    int xWidth;
    int yHeight;
    int Ascent;
    int Type;
    void* pwszAlternateText;
    void* pIStream;
}

HSP用 定義

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

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

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