Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

HOWTO: Access file/folder paths from dataobject in C++ during drag-drop

 
Subscribe to the RSS feed for this forum  Forum Index -> FileView ActiveX Control
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Fri Jan 16, 2009 10:04 am    Post subject: HOWTO: Access file/folder paths from dataobject in C++ during drag-drop

When a drag-drop operation occurs over FileView, The OnOnOleDragOver and OnOnOleDragDrop events occur. To get file/folder paths data from the data object, use the following code :

Code:

// FileView OnOnOleDragDrop event handler
void CErererDlg::OnOnOleDragDropFileviewctrl1(LPDISPATCH Data, long effect, long Button, long Shift, float X, float Y, LPDISPATCH Item, BOOL FAR* DoDefaultShellDropAction)
{
   CFIVDataObject dataObject;
   dataObject.AttachDispatch(Data,FALSE);

   CStringArray files;
   
   if (dataObject.GetFormat(CF_HDROP)) // Are file/folder paths present
   {
      VARIANT varFiles = dataObject.GetFiles();

      // File/folder paths are stored in the variant as an array of BSTRs
      if(varFiles.vt == (VT_ARRAY|VT_BSTR))
      {
         long i=0;
         BSTR file;
         while(SUCCEEDED(SafeArrayGetElement(varFiles.parray,&i,&file)))
         {
            CString temp = file;
            files.Add(temp);
            i++;
         }
      }
      VariantClear(&varFiles);
   }

   // At this point, 'files' contains all the files being drag-dropped
   
}
Back to top
Display posts from previous:   
Forum Index -> FileView ActiveX Control All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group