Advertisement

07.03.2008 at 04:53PM PDT, ID: 23538464
[x]
Attachment Details

Unable to get Drag and Drop FIles working

Asked by rossmcm in Delphi Components, Delphi Programming, Programming

Tags: ,

I have a D2006 app and want to implement  "open a file by dragging and dropping onto the main form".   The code fragments I an using are:

In the main form OnCreate

  DragAcceptFiles (Handle, True ) ;

In the main forms private section:

    procedure HandleDropFilesMessage      (var Message : TWMDropFiles); message WM_DROPFILES;

In the main form's message handler:

procedure TMainForm.HandleDropFilesMessage (var Message : TWMDropFiles);

var
    DropPt           : TPoint;
    FilesDropped     : Integer ;
    DroppedFileIndex : Integer ;

    DroppedName      : Array [0..255] of Char;
    S                : String;

begin
DragQueryPoint(Message.Drop,DropPt);
FilesDropped := DragQueryFile(Message.Drop, $FFFFFFFF, nil, 0);

for DroppedFileIndex := 1 to FilesDropped do
    begin
    DragQueryFile(Message.Drop, pred (DroppedFileIndex), DroppedName, SizeOf(DroppedName));
    S := StrPas (DroppedName);
    load_file (S) ;
    end ;

DragFinish(Message.Drop);
end;

It just doesn't work.  When a file is dragged onto the main form, I get the 'cannot drop here' cursor.  The strange thing is I have the same code working in another app.  There must be some property I'm not setting or something.Start Free Trial
 
Loading Advertisement...
 
[+][-]07.05.2008 at 12:47AM PDT, ID: 21936247

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.05.2008 at 01:05AM PDT, ID: 21936283

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.05.2008 at 06:15PM PDT, ID: 21938972

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.06.2008 at 02:03AM PDT, ID: 21939727

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.06.2008 at 04:22AM PDT, ID: 21939927

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.06.2008 at 11:59PM PDT, ID: 21943099

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.07.2008 at 12:27AM PDT, ID: 21943168

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.07.2008 at 03:21AM PDT, ID: 21943781

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.07.2008 at 04:12AM PDT, ID: 21943981

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.07.2008 at 03:32PM PDT, ID: 21949207

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.07.2008 at 11:55PM PDT, ID: 21951494

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Delphi Components, Delphi Programming, Programming
Tags: Delphi, BDS2006
Sign Up Now!
Solution Provided By: ziolko
Participating Experts: 2
Solution Grade: B
 
 
[+][-]07.08.2008 at 02:48AM PDT, ID: 21952220

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2008 at 08:43PM PDT, ID: 21960424

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.08.2008 at 08:46PM PDT, ID: 21960437

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628