Article View: borland.public.cppbuilder.nativeapi
Article #17129Re: Problem in deleting file!
From: user
Date: Mon, 07 Apr 2003 04:48
Date: Mon, 07 Apr 2003 04:48
31 lines
1982 bytes
1982 bytes
Safari wrote:
> Hello to all,
> I have problem, I can't delete files! Please help me.
>
> bool __fastcall RemoveFile(char *hPath)
> {
> SHFILEOPSTRUCT hFile;
> ZeroMemory(&hFile, sizeof(hFile));
> hFile.hwnd = 0;
> hFile.wFunc = FO_DELETE;
> hFile.pFrom = hPath;
> hFile.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
> return SHFileOperation(&hFile);
> }
>
> void __fastcall TMain::BitBtn4Click(TObject *Sender)
> {
> for (int a = ListView->Items->Count - 1; a >= 0; a--)
> {
> RemoveFile((ListView->Items->Item[a]->Caption).c_str());
> ListView->Items->Item[a]->Delete();
> }
> }
>
> Thanks,
> Safari.
>
This isn't an answer to the question you asked, but if you're deleting a
single file and don't care to put it into the Recycle bin, you might
find the API function DeleteFile() a bit more straightforward.
Technical Details
Message-ID:
<3E910319.8060608@domain.invalid>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3E8408FF.5040308@alloymail.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,5fde27ba165b16db X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-04-06 21:53:01 PST Message-ID: <3E910319.8060608@domain.invalid> Date: Mon, 07 Apr 2003 00:48:25 -0400 From: user@domain.invalid User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Problem in deleting file! References: <3E8408FF.5040308@alloymail.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 68.162.165.211 X-Trace: newsgroups.borland.com 1049690924 68.162.165.211 (6 Apr 2003 21:48:44 -0800) Lines: 32 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail