🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Controls Class BC5 vs BC6

#7828
From: Elias Berelian
Date: Wed, 22 Dec 2004 18:06
76 lines
3193 bytes
Thanks.


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:41c9b179$1@newsgroups.borland.com...
>
> "Elias Berelian" <eliasb@voyager.snetnsa.com> wrote in message
> news:41c9af28@newsgroups.borland.com...
>
> > I guess I was subclassing the main form. I copied the idea from
> > the following. Except in this case they are subclassing a Memo.
>
> That is a significant difference.
>
> > What should I do to be able to accept files anywhere on the form?
>
> I already told you what to do - override the WndProc() method instead of
> using the WindowProc property.
>
>
>     --- header ---
>
>     protected:
>         void __fastcall CreateWnd();
>         void __fastcall DestroyWnd();
>         void __fastcall WndProc(TMessage &Msg);
>
>
>     --- source ---
>
>     void __fastcall TForm1::CreateWnd()
>     {
>         TForm::CreateWnd();
>         if( HandleAllocated() )
>             DragAcceptFiles(Handle, TRUE);
>     }
>
>     void __fastcall TForm1::DestroyWnd()
>     {
>         if( HandleAllocated() )
>             DragAcceptFiles(Handle, FALSE);
>         TForm::DestroyWnd();
>     }
>
>     void __fastcall TForm1::WndProc(TMessage &Msg)
>     {
>         if( Msg.Msg == WM_DROPFILES )
>         {
>             int num_files = DragQueryFile((HDROP)Msg.WParam, 0xFFFFFFFF,
> NULL, NULL);
>             if( num_files == 1 )
>             {
>                 int NameLength = DragQueryFile((HDROP)Msg.WParam, 0, NULL,
> NULL);
>
>                 char *FileName = new char[NameLength];
>                 DragQueryFile((HDROP)Msg.WParam, 0, FileName, NameLength);
>
>                 Memo1->Lines->LoadFromFile(FileName);
>                 delete[] FileName;
>             }
>             else
>                 ShowMessage("too many files!");
>
>             DragFinish((HDROP)Msg.WParam);
>             Msg.Result = 0;
>             return;
>         }
>
>         TForm::WndProc(Msg);
>     }
>
>
> Gambit
>
>
Technical Details
Message-ID: <41c9b71b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41c31afb$1@newsgroups.borland.com> <41c35862$1@newsgroups.borland.com> <41c36850$1@newsgroups.borland.com> <41c9af28@newsgroups.borland.com> <41c9b179$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a08d779203a41a49
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Elias Berelian" <eliasb@voyager.snetnsa.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41c31afb$1@newsgroups.borland.com> <41c35862$1@newsgroups.borland.com> <41c36850$1@newsgroups.borland.com> <41c9af28@newsgroups.borland.com> <41c9b179$1@newsgroups.borland.com>
Subject: Re: Controls Class BC5 vs BC6
Date: Wed, 22 Dec 2004 13:06:03 -0500
Lines: 78
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 204.60.2.41
Message-ID: <41c9b71b@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1103738651 204.60.2.41 (22 Dec 2004 10:04:11 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail