How to obtain clipboard information with OleGetClipboard()

M

Michael

I have an application that makes a Visio IVWindow::Copy() automation call to
copy the contents of a window to the clipboard. I would then like to get the
data object using OleGetClipboard() after the copy returns. This seems to
work in most cases, but we have found that for windows that contain
significant amounts of data running on systems that are somewhat slow and
with less memory that OleGetClipboard() fails with CLIPBRD_E_CANT_OPEN.
Further, OpenClipboard() fails with GetLastError() returning a ZERO!!!

What needs to be done to get this to work? We have noticed that if we add
code that dispatches messages between the Copy() and the OleGetClipboard()
call, the OleGetClipboard() function will work. It appears that multiple
threads are involved here with possible use of RPC (even though we're still
not certain why this doesn't fail on fast systems).

Is there a way to determine when the Copy() has completed so that the
OleGetClipboard() function can be called? I think simply looping infinitely
in a dispatch scenario may be somewhat dangerous and cause the application to
hang if a true failure is present.
 
M

Michel LAPLANE \(MVP\)

Perhaps you can use a turn around.
Just export your drawing to a jpeg or EMF file and then use it in you
application as an image.
Don't forget that you can export a selection or a page.

Enjoy with visio.
 
M

Michael

No, that won't work. I don't want an image I want the Visio shape
information off the clipboard for an advanced application.
 
N

Nikolay Belyh

Probalby you can consider doing everything in "VisioIdle" even
handler. (this is event of the Application object)
Usually everything that did not work for some mysterious reasons
starts to work from there ;)

Kind regards, Nikolay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top