Re: file delete routine is intermittent
- From: "MikeD" <nobody@xxxxxxxxxxx>
- Date: Tue, 19 Apr 2005 17:16:50 -0400
"Steve Easton" <admin@xxxxxxxxxxxxx> wrote in message
news:%23AiLRTPRFHA.1564@xxxxxxxxxxxxxxxxxxxxxxx
> Having problems with the following trying to move files to the recycle
bin.
> It doesn't move all of the files. Any ideas??
>
> FOF_FLAGS = GetOptionFlags()
> For i = 1 To filenames.Count
> file2delete = filenames(i)
> With shf
> .wFunc = FO_DELETE 'action to take place
> .pFrom = file2delete 'the file to delete
The problem is likley in the above snippet. You must double-null terminate
the pFrom member. If you don't, SHFileOperation is ...unpredictable at best.
Try this:
..pFrom = file2delete & vbNullChar & vbNullChar 'the file to delete
For more information, see the Platform SDK on the SHFILEOPSTRUCT structure,
which states for the pFrom member:
pFrom
Address of a buffer to specify one or more source file names. These names
must be fully qualified paths. Standard DOS wild cards, such as "*", are
permitted in the filename position. Although this member is declared as a
null-terminated string, it is used as a buffer to hold multiple file names.
Each file name must be terminated by a single NULL character. An additional
NULL character must be appended to the end of the final name to indicate the
end of pFrom.
--
Mike
Microsoft MVP Visual Basic
.
- Follow-Ups:
- Re: file delete routine is intermittent
- From: Steve Easton
- Re: file delete routine is intermittent
- From: Jonathan Wood
- Re: file delete routine is intermittent
- References:
- file delete routine is intermittent
- From: Steve Easton
- file delete routine is intermittent
- Prev by Date: Re: System tray icons and callback messages
- Next by Date: Re: WIN32 API SOURCE
- Previous by thread: Re: file delete routine is intermittent
- Next by thread: Re: file delete routine is intermittent
- Index(es):
Relevant Pages
|