🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Drag 'n Drop of a folder (with textfiles) into a ListBox - confuse effect...

#5671
From: Oren Halvani
Date: Tue, 02 Aug 2005 08:07
103 lines
4479 bytes
Remy Lebeau (TeamB) schrieb:

> That would suggest that those messages are no longer reaching the ListBox at
> all.

ok....but why? i still have the same problem...

> I cannot reproduce the problem, though.  Everything works fine when I try
> your code.  You need to come up with a more specific test case that reliably
> reproduces the problem.

it's freezing when i process the dropped files...(text filtering..)
but i'll look later on it..

> Although not related to any looping problems persay, there are other
> problems with your code:
> 
> 1) you are still relying on the WM_DROPFILES message to begin with.  You
> really should be using OLE Drag&Drop instead.

when i will have really *alot* of time, i will study how to use the
OLE Drag&Drop functions...it's a huge work

> 2)
> Why are you doing all of that?  You could just construct the AnsiString
> directly in the call to FindFirst():
> 
>     int result = FindFirst(IncludeTrailingBackslash(caFileName) + "*.*",
> ...);

i'm using BCB 3 for this project, it's doesn't include the:
IncludeTrailingBackslash() function, so i have to trick around..

> 3)...
> 4)...

i've changed them...but something is still not working..the ListBox doesn't
receive the Events (OnClick, OnDoubleClick, OnKeyPress....)
without those events my programm is completly useless :-(

i've commented out the whole WMDropFiles function - and it works fine,
(when adding files manualy to the ListBox) but i need the drag 'n drop
because the work could be done much, much faster...

so i'm 100 % sure the problem is inside the WMDroFiles function..
do you have any ideas...?


//here's the complete code..
/*****************************************************************/

    int ilFilesCount, ilStrLength;
    char caFileName[MAX_PATH];

    ilFilesCount = DragQueryFile((HDROP)Message.Drop, -1, NULL, 0);

    for(int ilIndex = 0; ilIndex < ilFilesCount; ilIndex++)
    {
      ilStrLength = DragQueryFile((HDROP)Message.Drop,ilIndex,NULL,0);
      DragQueryFile((HDROP)Message.Drop, ilIndex, caFileName, ilStrLength+1);


      // folder...
      /*****************************************************************/
      if(FileGetAttr(caFileName) & faDirectory)
      {
         TSearchRec searchRecord;

         String filename = caFileName, wildcard = "\\*.*", strResult = filename + wildcard;

         char const * Result = strResult.c_str();
         int result = FindFirst(Result, faAnyFile & ~faDirectory, searchRecord);

         while(result == 0)
         {
            if(IsAscii(searchRecord.Name))
            {
               FileBox->Items->Add(searchRecord.Name);
            }
            result = FindNext(searchRecord);
         }
         FindClose(searchRecord);
      }

      // single file...
      /*****************************************************************/
      else
      {
         if(IsAscii(caFileName))
         {
            FileShow(caFileName);
            SaveRegFiles();
            FileBox_Operations();
         }
         else
         {
            MessageBox(NULL, msg_BinaryFile.c_str(), msg_BinaryFileTitle.c_str(),
            MB_OK|MB_DEFBUTTON2|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST);
         }
      }
      if(ilFilesCount > 1) txtCurrentFile->Text = caFileName;
    }
/*****************************************************************/
Technical Details
Message-ID: <42ef29dc$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <42eebf1b@newsgroups.borland.com> <42eec485$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d5e6340a5f435d04
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 02 Aug 2005 10:07:58 +0200
From: Oren Halvani <xx@xx.com>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: de-DE, de, en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Drag 'n Drop of a folder (with textfiles) into a ListBox - confuse
 effect...
References: <42eebf1b@newsgroups.borland.com> <42eec485$1@newsgroups.borland.com>
In-Reply-To: <42eec485$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 84.176.53.2
Message-ID: <42ef29dc$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1122970076 84.176.53.2 (2 Aug 2005 01:07:56 -0700)
Lines: 103
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail