problems with the ole clipboard
problems with the ole clipboard
i'm trying to understand how autocad handles copy/paste to allow drawing items to be copied between our application and autocad.
as far as i can understand items are saved to a temp file on copy and then loaded again on paste.
i've so far only tested with the code in the odamfcapp sample but i'm having problems getting even this sample application to copy reliably.
i load a file in odamfcapp, select and copy one item in the vector view.
most times this will then paste just fine in autocad.
next i go back to odamfcapp, select and copy another item.
but now autocad will give me an error message no matter what i try to copy from the app. "cannot insert autocad drawing file as ole object."
if i now restart the app and load the same drawing i can yet again (most of the time) copy one of the items on the drawing but as soon as i try to copy a 2nd item i get the same error.
any ideas what could be causing this behaviour?
testing with precompiled odamfcappdll.exe from 1.14.02 release and autocad mech 2005.
regards,
mikael
i reproduced it. it seems the reason is bug in odamfcapp in handling ctrl/c - ctrl/v.
drag&drop (working correctly) uses the same functionality from dd (wblockcloneobjects and saving to temp file).
sergey slezkin
this is a bug in the sample.
to fix it, replace codamfcappdoc:

neditcopy() method code with
code:
{
coledatasource* ds = new coledatasource();
m_stemppath = createdatasource( *ds );
ds->setclipboard();
}
vladimir
great! that works just fine.
now i only need to rewrite this to work in a non mfc environment...
back to to 'inside ole 2nd ed' i suppose.