ziv
asked on
Problem enabling drag-drop target for a CDialog window...
Hi,
I'm trying to enable simple file dragging into my CDialog based window and encountering a problem.
I followed the instructions in the documentation (how to implement.. for non CView based windows), and here's the chopped code:
// override for COleDropTarget:
class CMyDropTarget : public COleDropTarget
{
public:
virtual BOOL OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point );
};
class CMyDlg : public CDialog
{
public:
...
CMyDropTarget droptarget;
...
// and OnCreate handeling
}
..
int CMyDlg::OnCreate(LPCREATES TRUCT lpCreateStruct)
{
...
droptarget.Register( (CWnd*)this );
DragAcceptFiles(TRUE);
}
BOOL CMyDropTarget::OnDrop(CWnd * pWnd, COleDataObject
*pDataObject, DROPEFFECT dropEffect, CPoint point)
{
Beep(1000,200);
return TRUE;
}
Thats about it as described in the How-To documentation. I even initialized the OLE libraries although i dont need ole capabilities.
The result, I can drag items onto my dialog (shows the arrow with a plus sign), but I drop and my OnDrop never gets called (no Beep or breakpoint)...
Any ideas what could be wrong?
Thanks ahead,
Ziv
I'm trying to enable simple file dragging into my CDialog based window and encountering a problem.
I followed the instructions in the documentation (how to implement.. for non CView based windows), and here's the chopped code:
// override for COleDropTarget:
class CMyDropTarget : public COleDropTarget
{
public:
virtual BOOL OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point );
};
class CMyDlg : public CDialog
{
public:
...
CMyDropTarget droptarget;
...
// and OnCreate handeling
}
..
int CMyDlg::OnCreate(LPCREATES
{
...
droptarget.Register( (CWnd*)this );
DragAcceptFiles(TRUE);
}
BOOL CMyDropTarget::OnDrop(CWnd
*pDataObject, DROPEFFECT dropEffect, CPoint point)
{
Beep(1000,200);
return TRUE;
}
Thats about it as described in the How-To documentation. I even initialized the OLE libraries although i dont need ole capabilities.
The result, I can drag items onto my dialog (shows the arrow with a plus sign), but I drop and my OnDrop never gets called (no Beep or breakpoint)...
Any ideas what could be wrong?
Thanks ahead,
Ziv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If you meant something else or got other ideas please reply.