-----------------------------------------------
FORMATETC STRUCTURE AND CLIPFORMAT
January 2026
-----------------------------------------------
CCB
1. THE FORMATETC STRUCTURE:
typedef struct tagFORMATETC {
CLIPFORMAT cfFormat;
DVTARGETDEVICE *ptd;
DWORD dwAspect;
LONG lindex;
DWORD tymed;
} FORMATETC, *LPFORMATETC;
2. REFERENCE CODE:
I have found some code such as:
; cfFormat = di
mov word ptr [ ebp - 60 ] , di
So CLIPFORMAT is a WORD, it is not a DWORD, in 16-bit Windows and 32-bit Windows (x86) and 64-bit Windows (x64).
The 32-bit FORMATETC structure:
typedef struct tagFORMATETC {
WORD cfFormat; // 0x00
WORD padding1; // 0x02
DVTARGETDEVICE *ptd; // 0x04
DWORD dwAspect; // 0x08
LONG lindex; // 0x0C
DWORD tymed; // 0x10
} FORMATETC, *LPFORMATETC;
The size of 32-bit FORMATETC structure data is 0x14 bytes.
The 64-bit FORMATETC structure:
typedef struct tagFORMATETC {
WORD cfFormat; // 0x00
WORD padding1; // 0x02
DWORD padding2; // 0x04
DVTARGETDEVICE *ptd; // 0x08
DWORD dwAspect; // 0x10
LONG lindex; // 0x14
DWORD tymed; // 0x18
} FORMATETC, *LPFORMATETC;
The size of 64-bit FORMATETC structure data is 0x1C bytes.
3. REFERENCE WEBSITES:
1, Why is CLIPFORMAT defined to be a WORD rather than a UINT?
http://blogs.msdn.com/b/oldnewthing/archive/2011/11/28/10241836.aspx
4. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|