I have copied a image from mspaint to clipboard.
This is my command button code. Neither CF_BITMAP nor CF_DIB works.
invoke OpenClipboard,0
invoke IsClipboardFormatAvailable,CF_BITMAP
.if eax
invoke GetClipboardData,CF_BITMAP
.if eax
nop
.else
invoke GetLastError
.endif
.endif
invoke closeClipboard
OpenClipboard returns TRUE
IsClipboardFormatAvailable returns TRUE
GetClipboardData returns 0
and GetLastError gives errorcode for "Thread does not have a clipboard open".
With Clipbrd.exe I can see the image but my code will not work. Cannot figure out what's wrong. Any suggestions how to solve this?
Best regards
not sure this applies, but.....
QuoteNot all clipboard commands are available to the user at any given time. An application should process the
WM_INITMENUPOPUP message to enable the menu items for available commands and disable unavailable commands.
http://msdn.microsoft.com/en-us/library/ms649016%28v=VS.85%29.aspx
The picture is huge? Then try this link (http://www.codeproject.com/Messages/3279377/Re-EmptyClipboard-gives-an-error-1418-Thread-does-.aspx).
Try using a window handle for the OpenClipboard call.
Try what donkey said.
But first of all you should close the clipboard using 'CloseClipboard'
Thank you for your answers.
If I close the clipboard and then open it it will work with handle equ 0 as Coma suggested.
Earlier I have tryed to use a window handle for the OpenClipboard call without success. But suddenly it works with a window handle. I have been strugling with the problem a longer time so I must have changed something so it will work with a handle. So it will work as Donkey suggested without closing but with a window handle.
My huge images can't be loaded via clipboard. Mspaint uses over 1GB memory and memory page almost 2 GB before I have to terminate the app. Must be saved as files.
My WM_INITMENUPOPUP already enables and disables commands.
Thank you very much for your help.
Regards