//////////////////////////////////////// ///////////
// Adds drag-and-drop support for the dialog box
1. Dialog Box in. H (Message ing table)
Afx_msg void ondropfiles (hdrop hdropinfo );
2,. cpp
On_wm_dropfiles ()
When you add a function, the function implementation function is needed.
Void clooklogdlg: ondropfiles (hdrop hdropinfo)
{
// Todo: add your message handler code here and/or call default
Cstring filename [1000]; // This array limits that up to 1000 files can be dragged and dropped.
// ++ ++
Int filecount = dragqueryfile (hdropinfo, 0 xffffffff,); // gets the number of drag-and-drop files.
For (INT I = 0; I <min (filecount, 1000); I ++)
{
Dragqueryfile (hdropinfo, I, filename [I]. getbuffer (512), 512 );
Filename [I]. releasebuffer ();
}
Afxmessagebox (filename [0]);
// ++ ++
Cdialog: ondropfiles (hdropinfo );
}
3. Finally, remember to check the accept files check box on the extended styles page in the resource properties of the corresponding dialog box.
OK. That's simple.