🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Remove multiple files to Recycle Bin

#17165
From: Rodolfo Frino::Stargate Software
Date: Tue, 08 Apr 2003 10:27
42 lines
2107 bytes
I use this function:

void Delete_AllFiles(TForm* pForm, char* s)
{
    char Buffer[MAX_PATH];

    // Create an object of the class SHFILEOPSTRUCT.
    SHFILEOPSTRUCT oFile;

    memset(Buffer, 0, sizeof(Buffer));       //Init Buffer to 0
    memset(&oFile, 0, sizeof(oFile));        //Set Structure to 0

    // Make the application (Form1) to be the Owner of the
    // Progress Dialog Box that is displayed while
    // the delete operation takes place
    oFile.hwnd = pForm->Handle;

    //Set the Operation to be performed
    oFile.wFunc = FO_DELETE;

    //Set the directory you want to delete
    strcpy(Buffer, s);
    oFile.pFrom  = Buffer;
    oFile.fFlags = FOF_ALLOWUNDO;

    SHFileOperation(&oFile);
}
//----------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    //Examples
    //Delete_AllFiles(Form1, "c:\\__TEST\\*.*");

    Delete_AllFiles(Form1, Edit1->Text.c_str());
}

Rodolfo

"Konstantin Polyakov" <support@chemtable.com> wrote in message
news:3e906b66@newsgroups.borland.com...
> Hello, All!
Technical Details
Message-ID: <3e92a381$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3e906b66@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,1c6a0918c882faad
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-08 03:43:22 PST
From: "Rodolfo Frino::Stargate Software" <rodolfofrino@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e906b66@newsgroups.borland.com>
Subject: Re: Remove multiple files to Recycle Bin
Date: Tue, 8 Apr 2003 20:27:47 +1000
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 211.28.77.205
Message-ID: <3e92a381$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049797505 211.28.77.205 (8 Apr 2003 03:25:05 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail