News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Problem with clipboard

Started by minor28, November 28, 2010, 06:00:39 PM

Previous topic - Next topic

minor28

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

dedndave

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


jj2007


donkey

Try using a window handle for the OpenClipboard call.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Coma

Try what donkey said.
But first of all you should close the clipboard using 'CloseClipboard'
Coma Homepage 20:00-23:00 GMT+2 --- http://ge2001.dyndns.org:44792

minor28

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