ホーム › System.Ole › OLEUIPASTEENTRYA
OLEUIPASTEENTRYA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| fmtetc | FORMATETC | 32/20 | +0 | +0 | 貼り付け可能なデータ形式を記述するFORMATETCである。 |
| lpstrFormatName | LPSTR | 8/4 | +32 | +20 | 形式の表示名(ANSI)である。%sを含むとオブジェクト型名に置換される。 |
| lpstrResultText | LPSTR | 8/4 | +40 | +24 | 貼り付け結果の説明文字列(ANSI)である。 |
| dwFlags | DWORD | 4 | +48 | +28 | このエントリの動作フラグ(OLEUIPASTE_系)である。 |
| dwScratchSpace | DWORD | 4 | +52 | +32 | アプリが自由に使用できる予約領域である。 |
各言語での定義
#include <windows.h>
// FORMATETC (x64 32 / x86 20 バイト)
typedef struct FORMATETC {
WORD cfFormat;
DVTARGETDEVICE* ptd;
DWORD dwAspect;
INT lindex;
DWORD tymed;
} FORMATETC;
// OLEUIPASTEENTRYA (x64 56 / x86 36 バイト)
typedef struct OLEUIPASTEENTRYA {
FORMATETC fmtetc;
LPSTR lpstrFormatName;
LPSTR lpstrResultText;
DWORD dwFlags;
DWORD dwScratchSpace;
} OLEUIPASTEENTRYA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FORMATETC
{
public ushort cfFormat;
public IntPtr ptd;
public uint dwAspect;
public int lindex;
public uint tymed;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OLEUIPASTEENTRYA
{
public FORMATETC fmtetc;
public IntPtr lpstrFormatName;
public IntPtr lpstrResultText;
public uint dwFlags;
public uint dwScratchSpace;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FORMATETC
Public cfFormat As UShort
Public ptd As IntPtr
Public dwAspect As UInteger
Public lindex As Integer
Public tymed As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure OLEUIPASTEENTRYA
Public fmtetc As FORMATETC
Public lpstrFormatName As IntPtr
Public lpstrResultText As IntPtr
Public dwFlags As UInteger
Public dwScratchSpace As UInteger
End Structureimport ctypes
from ctypes import wintypes
class FORMATETC(ctypes.Structure):
_fields_ = [
("cfFormat", ctypes.c_ushort),
("ptd", ctypes.c_void_p),
("dwAspect", wintypes.DWORD),
("lindex", ctypes.c_int),
("tymed", wintypes.DWORD),
]
class OLEUIPASTEENTRYA(ctypes.Structure):
_fields_ = [
("fmtetc", FORMATETC),
("lpstrFormatName", ctypes.c_void_p),
("lpstrResultText", ctypes.c_void_p),
("dwFlags", wintypes.DWORD),
("dwScratchSpace", wintypes.DWORD),
]#[repr(C)]
pub struct FORMATETC {
pub cfFormat: u16,
pub ptd: *mut core::ffi::c_void,
pub dwAspect: u32,
pub lindex: i32,
pub tymed: u32,
}
#[repr(C)]
pub struct OLEUIPASTEENTRYA {
pub fmtetc: FORMATETC,
pub lpstrFormatName: *mut core::ffi::c_void,
pub lpstrResultText: *mut core::ffi::c_void,
pub dwFlags: u32,
pub dwScratchSpace: u32,
}import "golang.org/x/sys/windows"
type FORMATETC struct {
cfFormat uint16
ptd uintptr
dwAspect uint32
lindex int32
tymed uint32
}
type OLEUIPASTEENTRYA struct {
fmtetc FORMATETC
lpstrFormatName uintptr
lpstrResultText uintptr
dwFlags uint32
dwScratchSpace uint32
}type
FORMATETC = record
cfFormat: Word;
ptd: Pointer;
dwAspect: DWORD;
lindex: Integer;
tymed: DWORD;
end;
OLEUIPASTEENTRYA = record
fmtetc: FORMATETC;
lpstrFormatName: Pointer;
lpstrResultText: Pointer;
dwFlags: DWORD;
dwScratchSpace: DWORD;
end;const FORMATETC = extern struct {
cfFormat: u16,
ptd: ?*anyopaque,
dwAspect: u32,
lindex: i32,
tymed: u32,
};
const OLEUIPASTEENTRYA = extern struct {
fmtetc: FORMATETC,
lpstrFormatName: ?*anyopaque,
lpstrResultText: ?*anyopaque,
dwFlags: u32,
dwScratchSpace: u32,
};type
FORMATETC {.bycopy.} = object
cfFormat: uint16
ptd: pointer
dwAspect: uint32
lindex: int32
tymed: uint32
OLEUIPASTEENTRYA {.bycopy.} = object
fmtetc: FORMATETC
lpstrFormatName: pointer
lpstrResultText: pointer
dwFlags: uint32
dwScratchSpace: uint32struct FORMATETC
{
ushort cfFormat;
void* ptd;
uint dwAspect;
int lindex;
uint tymed;
}
struct OLEUIPASTEENTRYA
{
FORMATETC fmtetc;
void* lpstrFormatName;
void* lpstrResultText;
uint dwFlags;
uint dwScratchSpace;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; OLEUIPASTEENTRYA サイズ: 36 バイト(x86)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; fmtetc : FORMATETC (+0, 20byte) varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; lpstrFormatName : LPSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; lpstrResultText : LPSTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwFlags : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwScratchSpace : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OLEUIPASTEENTRYA サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; fmtetc : FORMATETC (+0, 32byte) varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; lpstrFormatName : LPSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; lpstrResultText : LPSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; dwFlags : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; dwScratchSpace : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FORMATETC
#field short cfFormat
#field intptr ptd
#field int dwAspect
#field int lindex
#field int tymed
#endstruct
#defstruct global OLEUIPASTEENTRYA
#field FORMATETC fmtetc
#field intptr lpstrFormatName
#field intptr lpstrResultText
#field int dwFlags
#field int dwScratchSpace
#endstruct
stdim st, OLEUIPASTEENTRYA ; NSTRUCT 変数を確保
st->dwFlags = 100
mes "dwFlags=" + st->dwFlags