MFC, vs2015 build a dialog-based application, put an edit box on the dialog box and a list box, the two Acccept Files are set to True, WM_DROPFILES message response function is added in the class wizard OnDropFiles, then at runtime, to drag the file list box, can response OnDropFiles function, and to edit box drag Files but no response, how can I do to make the edit box also response OnDropFiles function? Thank you very much!
CodePudding user response:
Afx_msg void OnDropFiles (HDROP hDropInfo);
ON_WM_DROPFILES ()
Void CMoveEdit: : OnDropFiles (HDROP hDropInfo) { TCHAR lpszFile [MAX_PATH + 1]; Int the numFiles=DragQueryFile (hDropInfo, 0 XFFFFFFFF, NULL, 0). AfxDump & lt; For (int independence idx=0; Independence idx & lt; The numFiles; Idx++) { DragQueryFile (hDropInfo, independence idx lpszFile, MAX_PATH); SetSel (1, 1); ReplaceSel (lpszFile); SetSel (1, 1); ReplaceSel (" \ r \ n "); } DragFinish (hDropInfo); }