1.控件“屬性”的“消息列表”給WM_DROPFILES添加消息處理函數OnDropFiles
2.在函數void CImgAnalysis::OnDropFiles(HDROP hDropInfo)中獲取文件的路徑
void CImgAnalysis::OnDropFiles(HDROP hDropInfo)
{
CString strFilePath;
m_vectorFilePath.clear();
int iDropCout = DragQueryFile(hDropInfo, -1, NULL, 0);
for (int iNum = 0; iNum < iDropCount; iNum++)
{
strFilePath.Empty();
DragQueryFile(hDropInfo, iNum, strFilePath.GetBuffer(MAX_PATH), MAX_PATH);
m_vectorFilePath.push_back(strFilePath);
}
/*然後程式作者調用m_vectorFilePath來操作文件*/
CDialog::OnDropFiles(hDropInfo);
}