SAMPLE: FileDrag.exe Supports File Drag Server Capabilities

ID: Q139067


The information in this article applies to:


SUMMARY

FileDrag.exe is a sample that shows how an application can provide the File Drag drop server capabilities. The sample shows how to set up the data structures for CF_HDROP and ShellIDList formats. In this sample, the user can enable support for any combination of CF_HDROP and ShellIDList format and see the drag drop result.


MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

~ FileDrag.exe

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

Q119591 How to Obtain Microsoft Support Files from Online Services



In Windows 3.x, the only application that could act as a File Drag-Drop server was File Manager. Now the file drag-drop server capability is extended to all applications through OLE Drag Drop.

An OLE drag-drop server application that supports the CF_HDROP format can support file drag drop as does File Manager. The Windows system generates the appropriate WM_DROPFILES message for client applications that support File Drop, or the Windows system passes the IDataObject if the client application supports OLE Drop target for CF_HDROP format.

One of the new features of the shell is that you can drop files on a desktop icon. The Shell opens the particular application with the drop file in it, provided the application supports command line arguments where file can be passed. For example:


   notepad.exe myfile.txt 


A file drag drop server that supports the ShellIDList format and the CF_HDROP format could also provide this feature.

NOTE: When you drag and drop a file from this sample, it leaves the files in the temp directory. The files are named myfile0.txt and myfile1.txt. These files are not deleted because they might by used by the other application (on which they are dropped). You can delete the files later on when you are done. The directory of these files is same as the directory defined by the TEMP environment variable. FileDrag.exe contains the following files:


   File Name       Description
   ------------------------------------------------------------------------
   IDataObj.cpp    Data Object Interface Implementation.
   IDropSrc.cpp    Drop Source Interface Implementation.
   OLEInit.cpp     OLE initialize/uninitialize Implementation.
   IeNumFe.cpp     FORMATETC Enumertator Interface Implementation.
   DrgDrps.CPP     Drag drop Main application implementation.
   RenderData.cpp  Functions to Format Data to Global handles.
   DrgDrps.H       Drag drop Main application prototypes.
   IDataObj.h      Data Object Interface prototypes.
   IDropSrc.h      Drop Source Interface prototypes.
   IENumFe.h       FORMATETC Enumertator Interface prototypes.
   OLEInit.h       OLE initialize/uninitialize prototypes.
   Resource.h      Resource header file.
   RenderData.h    Functions definitions for Format Data to Global handles.
   Pidl.dll        Helper DLL for Pidl manipulation functions.
   DrgDrps.def     Def file.
   FileDrag.mak    Make file.
   DrgDrps.bmp     Bitmap file.
   DrgDrps.ico     Icon file.
   DrgDrps.rc      Resource file.
   Pidl\DllMain.c  DLL initialization functions.
   Pidl\Globals.h  Global variables and prototypes.
   Pidl\Pidl.cpp   Pidl helper functions implementation.
   Pidl\Pidl.h     Pidl helper functions prototypes.
   Pidl\Pidl.def   Def file for the DLL. 


Keywords          : kbfile kbsample 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: March 3, 1999