Home > Software engineering >  Why don't edit box response OnDropFiles?
Why don't edit box response OnDropFiles?

Time:09-16

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);
}

CodePudding user response:

reference 1st floor schlafenhamster 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);
}

To the list box can drag files into the function, to edit box drag files does not (response) this function, I want to ask is how to edit box drag files to response the function, so the inside of the function code to write what, not important?

CodePudding user response:

Drag the DROPEFFECT is what?

CodePudding user response:

Do you want to response WM_DROPFILES news?

CodePudding user response:

reference 4 floor zjq9931 response:
do you want to response WM_DROPFILES news?

Yes, now to the edit box drag files, do not respond to this message!

CodePudding user response:

reference 5 floor weixin_44690344 reply:
Quote: refer to 4th floor zjq9931 response:
do you want to response WM_DROPFILES news?

Yes, now to the edit box drag files, do not respond to this message!

Vs2015 no, seemed to have no class wizard, vs2008 start this news can't directly add, a little round
You add the news is how to add?
I am on through the properties window to add new vs2008,

I can do,
  • Related