| Previous | Next |
| DV_E_DVTARGETDEVICE | DV_E_STATDATA |
DV_E_STGMEDIUM
Invalid STGMEDIUM structure
DV_E_STGMEDIUM is HRESULT 0x80040066. It means an OLE/COM data-transfer operation rejected the supplied STGMEDIUM. The declared tymed, active union member, resource validity, or release ownership does not satisfy the data-transfer contract.
What to check
- Match the union member to
tymed: for example, anIStream*must be paired withTYMED_ISTREAM, notTYMED_HGLOBAL. - Verify the handle or interface stored in the active member is valid and initialized.
- Check that the medium type was actually offered by the corresponding
FORMATETC. - Define ownership correctly. If
pUnkForReleaseis null, the receiver normally releases the medium withReleaseStgMedium; otherwise the supplied object controls release. - Do not release or reuse the underlying resource before the receiving operation has finished with it.
Record tymed, the active union member, pUnkForRelease, the producing IDataObject method, and the requested FORMATETC. Avoid logging transferred clipboard or document contents when the structure itself is sufficient for diagnosis.
Related results
DV_E_FORMATETC concerns the requested format description. DV_E_TYMED isolates an unsupported medium type. DV_E_STGMEDIUM means the actual storage container is invalid or inconsistent.
Example
A source stores an IStream* in the medium but labels it TYMED_HGLOBAL. Correcting the tymed value and using one documented release owner fixes the transfer contract.
References
Looking for a different code? Search another status or error code.
