views:

58

answers:

0

I have an MFC DocView SDI App that receives data from either the clipboard or drag and drop. The data is in either CF_HDROP or CF_TEXT format. I have a COleDropTarget derived CMyDropTarget member m_dropTarget of my CMainFrame class. I have two member functions of CMyDropTarget; OnDrop(...) and OnPaste() which each call another member function PostData(pDataObject).

I want to get a copy of the pDataObject from either CF_... format and PostMessage to my CmainFrame which will call a member of my Doc class. What is a simple way of getting a copy of the global data to pass with the PostMessage() so that I can get the drop source released before I get around to processing the global data? NOTE that they are always treated as a copy of the source data, so there is no need for the source to delete anything when the operation is done.

Or perhaps a better way of asking the question is: How can I release the Drop source before processing the global data? Can I pass the HGLOBAL via PostMessage and still release the source without making a copy of it?

EDIT by OP:

I think I now understand why all the things I have tried have not worked. All the code is being run in the same thread, so the PostMessage call must finish all its processing before the Drag source can be released. Does this sound like the reason?

related questions