Win32 API 日本語リファレンス
ホームSystem.Com.Urlmon › RemFORMATETC

RemFORMATETC

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

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

フィールド

フィールドサイズx64x86説明
cfFormatDWORD4+0+0クリップボード形式を示す値。FORMATETCのリモート表現。
ptdDWORD4+4+4ターゲットデバイス情報を表すDWORD値。装置非依存時は0。
dwAspectDWORD4+8+8データの表示アスペクトを示す値。コンテンツやアイコンなどを表す。
lindexINT4+12+12取得対象のデータ片インデックス。全体の場合は-1。
tymedDWORD4+16+16格納メディアの種類を示すTYMEDフラグ。HGLOBALやIStreamなど。

各言語での定義

#include <windows.h>

// RemFORMATETC  (x64 20 / x86 20 バイト)
typedef struct RemFORMATETC {
    DWORD cfFormat;
    DWORD ptd;
    DWORD dwAspect;
    INT lindex;
    DWORD tymed;
} RemFORMATETC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RemFORMATETC
{
    public uint cfFormat;
    public uint ptd;
    public uint dwAspect;
    public int lindex;
    public uint tymed;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RemFORMATETC
    Public cfFormat As UInteger
    Public ptd As UInteger
    Public dwAspect As UInteger
    Public lindex As Integer
    Public tymed As UInteger
End Structure
import ctypes
from ctypes import wintypes

class RemFORMATETC(ctypes.Structure):
    _fields_ = [
        ("cfFormat", wintypes.DWORD),
        ("ptd", wintypes.DWORD),
        ("dwAspect", wintypes.DWORD),
        ("lindex", ctypes.c_int),
        ("tymed", wintypes.DWORD),
    ]
#[repr(C)]
pub struct RemFORMATETC {
    pub cfFormat: u32,
    pub ptd: u32,
    pub dwAspect: u32,
    pub lindex: i32,
    pub tymed: u32,
}
import "golang.org/x/sys/windows"

type RemFORMATETC struct {
	cfFormat uint32
	ptd uint32
	dwAspect uint32
	lindex int32
	tymed uint32
}
type
  RemFORMATETC = record
    cfFormat: DWORD;
    ptd: DWORD;
    dwAspect: DWORD;
    lindex: Integer;
    tymed: DWORD;
  end;
const RemFORMATETC = extern struct {
    cfFormat: u32,
    ptd: u32,
    dwAspect: u32,
    lindex: i32,
    tymed: u32,
};
type
  RemFORMATETC {.bycopy.} = object
    cfFormat: uint32
    ptd: uint32
    dwAspect: uint32
    lindex: int32
    tymed: uint32
struct RemFORMATETC
{
    uint cfFormat;
    uint ptd;
    uint dwAspect;
    int lindex;
    uint tymed;
}

HSP用 定義

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

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

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