🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Delete a file to Recycle Bin

#11026
From: Remy Lebeau (TeamB)
Date: Thu, 04 Mar 2004 21:32
53 lines
2977 bytes
"Mario Sernicola" <mariosernicola.nospam@libero.nospam.it> wrote in message
news:404789da$1@newsgroups.borland.com...
> My code doesn't work at all!!!

Try the following code instead (untested):

    if( ListView1->SelCount > 0 )
    {
        if( Application->MessageBox(SelectedFilesWillBeDeleted.c_str(),
PROGRAM_NAME, MB_ICONQUESTION | MB_OKCANCEL) == ID_OK )
        {
            int length = 0;

            TListItem *pItem = lvGridOthers->Selected;
            while( pItem )
            {
                length += (pItem->SubItems->Strings[1].Length() + 1);
                pItem = lvGridOthers->GetNextItem(pItem, sdAll,
TItemStates() << isSelected);
            }

            if( length > 0 )
            {
                AnsiString files;
                files.SetLength(length+1);
                char *ptr = files.c_str();

                pItem = lvGridOthers->Selected;
                while( pItem )
                {
                    AnsiString tmp = pItem->SubItems->Strings[1];
                    StrPCopy(ptr, tmp);
                    ptr += tmp.Length();
                    *ptr++ = '\0';
                    pItem = lvGridOthers->GetNextItem(pItem, sdAll,
TItemStates() << isSelected);
                }

                *ptr = '\0';

                SHFILEOPSTRUCT FileOpStr = {0};
                FileOpStr.hwnd = Application->Handle;
                FileOpStr.fFlags = FOF_ALLOWUNDO;
                FileOpStr.wFunc = FO_DELETE;
                FileOpStr.pFrom = files.c_str();
                SHFileOperation(&FileOpStr);
            }
        }
    }


Gambit
Technical Details
Message-ID: <40479e7f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4045ec37@newsgroups.borland.com> <4045f7da@newsgroups.borland.com> <4046024e@newsgroups.borland.com> <4046092a@newsgroups.borland.com> <40463c2d@newsgroups.borland.com> <40468126$1@newsgroups.borland.com> <4046dd24@newsgroups.borland.com> <4046ECF6.D92243F4@gmx.de> <404733ef@newsgroups.borland.com> <4047365b@newsgroups.borland.com> <40475805@newsgroups.borland.com> <4047615e$1@newsgroups.borland.com> <40478671@newsgroups.borland.com> <404789da$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,820b8d6a3def1656
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-04 13:40:30 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4045ec37@newsgroups.borland.com> <4045f7da@newsgroups.borland.com> <4046024e@newsgroups.borland.com> <4046092a@newsgroups.borland.com> <40463c2d@newsgroups.borland.com> <40468126$1@newsgroups.borland.com> <4046dd24@newsgroups.borland.com> <4046ECF6.D92243F4@gmx.de> <404733ef@newsgroups.borland.com> <4047365b@newsgroups.borland.com> <40475805@newsgroups.borland.com> <4047615e$1@newsgroups.borland.com> <40478671@newsgroups.borland.com> <404789da$1@newsgroups.borland.com>
Subject: Re: Delete a file to Recycle Bin
Date: Thu, 4 Mar 2004 13:32:50 -0800
Lines: 55
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: 67.22.138.253
Message-ID: <40479e7f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1078435455 67.22.138.253 (4 Mar 2004 13:24:15 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail