Solved

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

Posted on 1997-07-18
2
667 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to determine file rename from EventLog ? 2 36
sumNumber challenge 16 98
substring method in java 1 79
Hibernate methods 2 58
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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now