Click here to Skip to main content
16,016,024 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

There is a code which uses OLE drag-drop for drag from application to windows explorer. It uses delayed rendering and uses CFSTR_FILEDESCRIPTOR and CFSTR_FILECONTENTS formats. It is pretty much doing the normal stuffs:

i) It creates a Global Memory on LbuttonDown and stores the file/s selected.

ii) It is storing both the formats to be called for rendering.

iii) On calling RenderData, it is calling the over-ridden functions for GetData depending on the format specified.

The problem I am facing are two fold :

i) GetData for CFSTR_FILECONTENTS is not getting called always. the behavior is inconsistent. Anything I am missing that is causing this inconsistency ? Has it got to do by any chance with some kind of marshaling/unmarshaling.

ii) When GetData for CFSTR_FILECONTENTS is called, it gives me back an error "invalid memory location" and then bails out. The progress appears though with the proper file-name until I click ok.
When it is not called, progress bar appears but nothing happens [even file-name of the file to be transferred does not appear]. I will have to restart the explorer to get rid of it.

Has some one encountered any of the above problems or have suggestions for me to try out ?

Also, I have a question. How does the explorer get to know the file-name it is transferring ? I am not able to figure out where in the code file-name is being sent.


The code is too huge to post even the relevant stuffs. Please let me know if any particular is needed. Please Help. I am badly stuck.

Thanks,
Shishir
Posted

1 solution

Just found out what was wrong. Or atleast I think.

I dunno what to say.. I mean, I still can't get myself to accept that it was the reason. It may not be; but atleast it seemed to solve the problem for me.

Apparently, I was writing the file-name explicitly of the LPSTGMEDIUM structure in the over-ridden OnRenderData method of COleDataSource; which was btw empty if I remember properly. Like I said, it sounds plain stupid and should not be the reason.. But for what its worth, if someone encounters the same problem, they might want to try it out.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900