1、在h文件中加入afx_msg HCURSOR OnQueryDragIcon();
2、在cpp文件中加入 ON_WM_DROPFILES()
3、响应拖拽文件的消息
void CXXXDlg::OnDropFiles(HDROP hDropInfo)
{
UINT Num;
TCHAR filePath[MAX_PATH];
Num = DragQueryFile(hDropInfo, 0xFFFFFFFF, NULL, 0);
if(Num > 0)
{
for(UINT i = 0; i < Num; i++)
{
DragQueryFile(hDropInfo, i, filePath, sizeof(filePath));
//filePath为获取到的文件
}
}
DragFinish(hDropInfo);
CDialog::OnDropFiles(hDropInfo);
}