码迷,mamicode.com
首页 > 移动开发 > 详细

移动文件并将文件路径显示到编辑框内

时间:2017-10-31 22:48:40      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:编辑   inf   har   int   file   item   handler   for   apt   

This chapter we are study how to get the path of file by using drag drop.

Here is the code, enjoy:

 

 1 void CFileCrcDlg::OnDropFiles(HDROP hDropInfo) 
 2 {
 3     // TODO: Add your message handler code here and/or call default
 4     UINT i,iFileCount;
 5     char file_name[MAX_PATH];
 6     iFileCount=::DragQueryFile(hDropInfo,0xffffffff,NULL,0);
 7     for(i=0;i<iFileCount;i++)
 8     {
 9         if(i==0)
10         {
11             ::DragQueryFile(hDropInfo,i,file_name,MAX_PATH);
12             SetDlgItemText(IDC_EDIT1_path,file_name);
13         }
14         else 
15         {
16             ::DragQueryFile(hDropInfo,i,file_name,MAX_PATH);
17             SetDlgItemText(IDC_EDIT2_crc_hex,file_name);
18         }
19     }
20     ::DragFinish(hDropInfo);
21     CDialog::OnDropFiles(hDropInfo);
22 }

 

Thank you!

 

移动文件并将文件路径显示到编辑框内

标签:编辑   inf   har   int   file   item   handler   for   apt   

原文地址:http://www.cnblogs.com/lumao1122-Milolu/p/7764194.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!