|
-
June 17th, 2009, 08:18 PM
#1
Implementing drag n drop in a CRichEditView?
I have an SDI app (VS 2005, C++) that serializes a unique type of binary file with a unique (I think) suffix, *.mtx. I would like to be able to drag an *.mtx file from Windows Explorer to the CRichEditView main window of the interface. I could easily implement such a process provided that I could intercept the file path of the dragged and dropped file. As it is, the drag n drop action only produces a graphic square with the filename in it.
There are several methods available to the CRichEditView which appear relevant to the problem. These are: OnDragEnter, OnDragLeave, OnDragOver, OnDrop. In addition, there is apparently an OnBeginDrag which does not appear in the ProprertyPage class view for CRichEditView, but has appeared on several postings on the subject.
As a first step, I would like to capture the pathname of the file that a user drags onto the CREView window. The following code doesnt ever get called during a drag n drop of an *.mtx file
Code:
BOOL CMyRichEditView::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
{
// TODO: Add your specialized code here and/or call the base class
CFile * pFile = pDataObject->GetFileData(CF_TEXT);
CString csFileName = pFile->GetFileName();
CString csFilePath = pFile->GetFilePath();
MessageBox(csFileName);
return CRichEditView::OnDrop(pDataObject, dropEffect, point);
}
Can anyone help me to capture the drop file name?
mpliam
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|