Solved

Problem enabling drag-drop target for a CDialog window...

Posted on 1997-07-18
2
705 Views
Last Modified: 2013-11-20
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(LPCREATESTRUCT 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
0
Comment
Question by:ziv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
pcs071997 earned 100 total points
ID: 1302676
droptarget.Register( (CWnd*)this );i guess that wrong pointer.maybe GetParent(this);good luck!!!

0
 

Author Comment

by:ziv
ID: 1302677
If you mean do mydroptarget.Register( GetParent() ) thats no good, since my dialog is the main window of the application and its parent is null.
If you meant something else or got other ideas please reply.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question