Avoiding the Excel "Picture Is Too Large" error when reading the Clipboard
Posted: 06 Feb 2024, 17:32
Reading the Clipboard (or ClipboardAll) with AHK (v1) after copying cells in Excel displays the error message "The Picture Is Too Large and Will Be Truncated" (the error message is displayed by Excel, not AHK). This issue has been raised a few times on this forum (here and here) but it seems that it was never investigated.
This Techinline Blog post pretends that this error occurs when a third party app (my AHK script in this case) retrieves the content of the Clipboard for CF_METAFILEPICT format.
It would be great if @lexikos or another AHK insiders could take a look at it. Does the AHK runtime retrieve the CF_METAFILEPICT format when building ClipboardAll?
TIA
This Techinline Blog post pretends that this error occurs when a third party app (my AHK script in this case) retrieves the content of the Clipboard for CF_METAFILEPICT format.
My app is not reading specifically the CF_METAFILEPICT. It reads the system variables Clipboard and ClipboardAll. It also retrieves some specific formats (like HTML or RTF) using the WinClip library. But it never gets the CF_METAFILEPICT format.If your application interacts with the Windows clipboard using OLE technology, this indicates that somewhere your source code calls of the IDataObject interface. This interface contains the GetData method, which can result in the described Excel error when it tries to receive clipboard content in CF_METAFILEPICT format.
How to fix:
Skip the GetData call if the requested format is CF_METAFILEPICT.
It would be great if @lexikos or another AHK insiders could take a look at it. Does the AHK runtime retrieve the CF_METAFILEPICT format when building ClipboardAll?
TIA