The dialog box supports file drag and drop operations.

Source: Internet
Author: User
//////////////////////////////////////// ///////////
// 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.