🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3064

How to accept Drag 'n Drop from Outlook Express or any other application besides the Explorer...?

#3064
From: Oren Halvani
Date: Wed, 20 Sep 2006 01:15
50 lines
2637 bytes
dear builders,

can someone explain me what i should do if i want my programm to accept Drag 'n Drop
from Outlook Express (for instance: E-Mails or News-posts) or any other application ?

The below function works pretty fine for Drag 'n Drop of files from the Windows Explorer,
but what about other applications ???

Do i need to catch the Drag 'n Drop message of each specific application via:

           BEGIN_MESSAGE_MAP
              MESSAGE_HANDLER(WM_DROPFILES, TWMDropFiles, WMDropFiles);
           END_MESSAGE_MAP(TForm)

I've noticed, Drag 'n Drop of text into my program works from the most applications
that use lke my program the RichEdit control...so why can't I do the same Drag 'n Drop
for other things like: E-Mails from Outlook Express or Thunderbird, etc... ?



Oren

/***********************************************************/
void __fastcall TfrmMainUnit::WMDropFiles(TWMDropFiles &Message)
{
   int DropCount = DragQueryFile((HDROP)Message.Drop, -1, NULL, 0), StrLength;
   char FileName[MAX_PATH];

   for(int index = 0; index < DropCount; index++)
   {
     StrLength = DragQueryFile((HDROP)Message.Drop, index, NULL,0);
     DragQueryFile((HDROP)Message.Drop, index, FileName, StrLength + 1);

     if(FileGetAttr(FileName) & faDirectory) {AddFiles_Check(FileName);}
     else
     {
        FileShow(FileName);
        SaveRegFiles();
        FileBox_Operations();
     }
   }

   if(DropCount > 0)
   {
      FileBox->Selected[-1] = true;
      cmdEditMode->Down     = false;

      if(frmMainUnit->Active && txtContains->Enabled) txtContains->SetFocus();
   }
} 
Technical Details
Message-ID: <45109658@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8ecf2bd78c9968e3,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Oren Halvani" <Spam@halvani.de>
From: "Oren Halvani" <Spam@halvani.de>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: How to accept Drag 'n Drop from Outlook Express or any other application besides the Explorer...?
Date: Wed, 20 Sep 2006 03:15:52 +0200
Lines: 52
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 84.176.122.135
Message-ID: <45109658@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1158714968 84.176.122.135 (19 Sep 2006 18:16:08 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail