// 1) Allow your application to accept dropped files by calling the // following from your CMainFrame's OnCreate() message handler: // allow files to be dropped on main window or any child window DragAcceptFiles(); // 2) Add a WM_DROPFILES message handler to your CMainFrame class: void CMainFrame::OnDropFiles(HDROP hDropInfo) { // get filename stored in hDropInfo and use app to open it TCHAR szFileName[_MAX_PATH]; ::DragQueryFile(hDropInfo, 0, szFileName, _MAX_PATH); ::DragFinish(hDropInfo); AfxMessageBox(szFileName); }