15,979
社区成员
发帖
与我相关
我的任务
分享
void CMyDlg::OnDropFiles(HDROP hDropInfo)
{
// TODO: Add your message handler code here and/or call default
int iCount;
char pcFilePath[MAX_PATH];
int iPathLen;
int i;
iCount = DragQueryFile(hDropInfo, 0xffffffff, NULL, 0);
if(iCount>1) //限定一个,可以不做限定。
{
AfxMessageBox("一次只能检查一个工程哈!");
return;
}
iPathLen = DragQueryFile(hDropInfo, 0, pcFilePath, MAX_PATH);
for(i=iPathLen; i>0; i--)
{
if(pcFilePath[i]=='.')
{
break;
}
}
if(0 == memicmp(&pcFilePath[i], ".XXX", strlen(".kop")) ) //指定扩展名的。
{
m_strPath=pcFilePath; //文件名显示在编辑框中,这里改成列表框 也是可以的。
UpdateData(FALSE);
}
else
{
AfxMessageBox("请确认!");
return;
}
CDialog::OnDropFiles(hDropInfo);
}