🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Get message form app-window.

#11350
From: Cactus
Date: Sat, 14 Feb 2004 03:21
60 lines
2514 bytes
> First You need a line in the form constructor
>
>    DragAcceptFiles(Handle, true);
>
> and one in the form FormCloseQuery event
>
>    DragAcceptFiles(Handle, false);
>
> then You need to respond to the WMDropFiles message
>
> in the unit1.h file You need this:
>
> MESSAGE void __fastcall WMDropFiles(Messages::TWMDropFiles &Message);
>
> BEGIN_MESSAGE_MAP //  TMessage
> VCL_MESSAGE_HANDLER(WM_DROPFILES, TWMDropFiles, WMDropFiles)
> END_MESSAGE_MAP(TForm)//TForm TCustomLabel
>

Well, the Form's template can be "add to repository".
After copy the template by menu "new -> forms -> ..." :)



> and something like this in the unit1.cpp file
>
> MESSAGE void __fastcall TForm1::WMDropFiles(Messages::TWMDropFiles
> &Message)
> {
>    char Buf[MAX_PATH];
>    unsigned NumberOfFiles;
>    HANDLE Hnd_Drop = (void*)Message.Drop;
>
>    NumberOfFiles = DragQueryFile(Hnd_Drop, 0xFFFFFFFF, Buf, 0);
>
>    if(NumberOfFiles > 0)
>    {
>       for(unsigned i = 0; i < NumberOfFiles; i++)
>       {
>
>          memset(Buf,0,MAX_PATH);
>          DragQueryFile(Hnd_Drop, i, Buf, MAX_PATH);
>          ListBox->Items->Add(Buf);
>
>        }// End for(unsigned i = 0
>
>     }
>
>    DragFinish(Hnd_Drop);
>    Message.Result = 0;
> }
>
//--------------------------------------------------------------------------
-
>

I see, above function getting a list of files path & name.
Message's map not a easy work, I need time for test it.

Thanks you.
Technical Details
Message-ID: <402d9437$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <402ca730$1@newsgroups.borland.com> <MPG.1a96cdd05eca648198971c@newsgroups.borland.com> <402d0277$2@newsgroups.borland.com> <MPG.1a9736c98a64bf598971e@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,873ed39da4f4a729
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-13 19:39:42 PST
From: "Cactus" <a@b.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <402ca730$1@newsgroups.borland.com> <MPG.1a96cdd05eca648198971c@newsgroups.borland.com> <402d0277$2@newsgroups.borland.com> <MPG.1a9736c98a64bf598971e@newsgroups.borland.com>
Subject: Re: Get message form app-window.
Date: Sat, 14 Feb 2004 11:21:28 +0800
Lines: 62
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 218.15.254.156
Message-ID: <402d9437$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076728887 218.15.254.156 (13 Feb 2004 19:21:27 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail