Click to See Complete Forum and Search --> : COleDataSource::OnRenderFileData()


Alex Wilkens
April 3rd, 1999, 10:27 AM
Hi,

I'm implementing drag & drop using COleDataSource and delayed rendering
and have run into a problem. I setup my datasource with two clipboard
formats, CFSTR_FILEDESCRIPTOR and CFSTR_FILECONTENTS, where the last one
is added using DelayRenderFileData(). My FILEDECRIPTORs do not include
the size of the files as they are not always known in advance.

My OnRenderFileData() implementation is called and I write the data into
the provided CFile. The problem, however, is that the file written (when
I drag to for instance Explorer) is always a multiple of 4096 bytes, no
matter how much I actually writes to the CFile. It appears it writes the
number of bytes allocated (in the CSharedFile) and not the exact number
of bytes I have written. How can I get around this? (the problem does not
occur if I give a filesize in the file descriptors, but this only allows
me to write exactly that size).

Furthermore, the entire prosess seems to me to involve a LOT of realloc
calls as I write the CFile/CSharedFile using many small Write calls. Is
there anyway for it to write directly to the file on disk instead of all
this buffering and realloc'ing? What if I was rendering a 100MB file?

Thanks in advance for any ideas.

--
Alexander Wilkens
Enriva Development
http://www.enriva.com