Click here to Skip to main content
Sign Up to vote bad
good
See more: C++MFCVS2010
Hi all,
 
I have a MFC dialog C++ application in VS2010, And my application has two textbox is source folder(txtSrcfolder) and destination folder(txtDesFolder) so when I drag and drop a file to txtxDesFolder, I want to assign full file path to txtDesFolder and the same to txtSrcFolder.
But how to determine which textbox is draged to?
(if there is only one textbox i can handle it but with many control I can't)
 
Can you help me, please?
Posted 20 Jun '12 - 1:05
ngthtra1.3K


1 solution

Try to pass a box pointer to this test Smile | :) :
/*static*/ bool CYourDialog::TestDropWnd(CWnd* pcWndTest)
{
  CPoint cPoint;
  if (::GetCursorPos(&cPoint)) {
    return (pcWndTest == CWnd::WindowFromPoint(cPoint));
  }
  return false;
}
  Permalink  
Comments
ngthtra - 20 Jun '12 - 22:19
how to use this code?
Eugen Podsypalnikov - 21 Jun '12 - 1:55
At your "dropped" event, call this test for the both boxes (pass their pointers). The function will return true, if a testing box is under the mouse :)
ngthtra - 21 Jun '12 - 22:37
so what will pcWndTest parameter be inputed? I am using CAppDlg::OnDropFiles(HDROP hDropInfo){} to get folder path
Eugen Podsypalnikov - 22 Jun '12 - 3:24
In the context of your dialog: bool bDroppedOnSrcBox(GetDlgItem(IDC_SRC_BOX)); // IDC_SRC_BOX is the resource ID of the box bool bDroppedOnTrgBox(GetDlgItem(IDC_TRG_BOX)); // IDC_TRG_BOX is the resource ID of the box

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 611
1 Maciej Los 265
2 Slacker007 240
3 CPallini 235
4 OriginalGriff 210
0 Sergey Alexandrovich Kryukov 9,118
1 OriginalGriff 7,134
2 CPallini 3,803
3 Rohan Leuva 3,135
4 Maciej Los 2,558


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 20 Jun 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid