Created
September 21, 2012 13:30
-
-
Save kimkidong/3761470 to your computer and use it in GitHub Desktop.
[MFC] File Drag&Drop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Cdrag_and_dropDlg::OnDropFiles(HDROP hDropInfo) | |
{ | |
LPTSTR pFileName = NULL; | |
DWORD dwNumDrop = 0, | |
dwBufSize = 0; | |
dwNumDrop = DragQueryFile(hDropInfo,0xFFFFFFFF, NULL, 0L); | |
for (int i = 0 ; i < dwNumDrop ; ++i) | |
{ | |
// get file name length | |
dwBufSize = DragQueryFile(hDropInfo,i,NULL,0)+1; | |
// allocate memory | |
pFileName = (LPTSTR)new TCHAR[dwBufSize]; | |
// get file name | |
DragQueryFile(hDropInfo,i,pFileName,dwBufSize); | |
// add the container(deque) | |
this->RomFile.push_back(pFileName); | |
pFileName = NULL; | |
// show message about drag filename | |
AfxMessageBox(this->RomFile[i]); | |
} | |
CDialogEx::OnDropFiles(hDropInfo); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment