For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > September 2006 > SHFileOperation return value









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SHFileOperation return value
Syed Zeeshan Haider

2005-11-27, 6:55 pm

Hello Everybody,
I have VB6 EE on WinXP SP2.

I am using API SHFileOperation to move some folders to Recycle Bin. In case
of some specific folders, SHFileOperation returns 32 instead of 0 and a
message similar to following appears:

"Cannot delete MyFolder: It is being used by another person or program.
Close any programs that might be using the file and try again."

The weird thing is when I delete the same folder manually from Windows
Explorer, no error occurs. Is there any special way to handle
SHFileOperation when it returns 32?

What does SHFileOperation mean when it returns 32?

Thank you,
--
Syed Zeeshan Haider


--------------------------------------------------------------------------------
Learn about famous muslim names at http://szh.20m.com/learn/aboutnames.html


Bob Butler

2005-11-27, 6:55 pm

"Syed Zeeshan Haider" <szhatforumsDELETE@hotpop.SPAMS.com> wrote in
message news:eyT$NW28FHA.1276@TK2MSFTNGP09.phx.gbl
> Hello Everybody,
> I have VB6 EE on WinXP SP2.
>
> I am using API SHFileOperation to move some folders to Recycle Bin.
> In case of some specific folders, SHFileOperation returns 32 instead
> of 0 and a message similar to following appears:
>
> "Cannot delete MyFolder: It is being used by another person or
> program. Close any programs that might be using the file and try
> again."
>
> The weird thing is when I delete the same folder manually from Windows
> Explorer, no error occurs. Is there any special way to handle
> SHFileOperation when it returns 32?
>
> What does SHFileOperation mean when it returns 32?


It means exactly what it says... The standard text for error 32 is
The process cannot access the file because it is being used by another
process.

Has your code opened the folder in question in any way (e.g. by using the
Dir$ function)? It soubds like maybe by the time your app exits and you try
to delete it in Explorer the folder is no longer in use.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

Syed Zeeshan Haider

2005-11-27, 6:55 pm

"Bob Butler" <tiredofit@nospam.com> wrote in message
news:O2S9eZ28FHA.4076@tk2msftngp13.phx.gbl...

> Has your code opened the folder in question in any way (e.g. by using the
> Dir$ function)? It soubds like maybe by the time your app exits and you
> try
> to delete it in Explorer the folder is no longer in use.


No. My software successfully deletes (to recycle bin) most of the folders.
The problem arises only with those folders which contain a system file named
"Thumbs.db".

How can this file prevent the folder from deletion?
--
Syed Zeeshan Haider


--------------------------------------------------------------------------------
Learn about famous muslim names at http://szh.20m.com/learn/aboutnames.html


Bob Butler

2005-11-27, 6:55 pm

"Syed Zeeshan Haider" <szhatforumsDELETE@hotpop.SPAMS.com> wrote in
message news:eflp7x48FHA.1484@tk2msftngp13.phx.gbl
> "Bob Butler" <tiredofit@nospam.com> wrote in message
> news:O2S9eZ28FHA.4076@tk2msftngp13.phx.gbl...
>
>
> No. My software successfully deletes (to recycle bin) most of the
> folders. The problem arises only with those folders which contain a
> system file named "Thumbs.db".
>
> How can this file prevent the folder from deletion?


Perhaps an anti-virus checker running in the background is interfering?

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

Galen Somerville

2005-11-27, 6:55 pm


"Syed Zeeshan Haider" <szhatforumsDELETE@hotpop.SPAMS.com> wrote in message
news:eflp7x48FHA.1484@tk2msftngp13.phx.gbl...
> "Bob Butler" <tiredofit@nospam.com> wrote in message
> news:O2S9eZ28FHA.4076@tk2msftngp13.phx.gbl...
>
the[color=darkred]
>
> No. My software successfully deletes (to recycle bin) most of the folders.
> The problem arises only with those folders which contain a system file

named
> "Thumbs.db".
>
> How can this file prevent the folder from deletion?
> --
> Syed Zeeshan Haider
>

I found 6 Thumbs.db on my computer and 4 of them were "Read only". This may
prevent your deletions.

Galen


MikeD

2005-11-27, 6:55 pm


"Galen Somerville" <galen@surewest.net> wrote in message
news:eRQQVP58FHA.2364@TK2MSFTNGP12.phx.gbl...
>
> "Syed Zeeshan Haider" <szhatforumsDELETE@hotpop.SPAMS.com> wrote in
> message
> news:eflp7x48FHA.1484@tk2msftngp13.phx.gbl...
> the
> named
> I found 6 Thumbs.db on my computer and 4 of them were "Read only". This
> may
> prevent your deletions.



Possibly, but I think SHFileOperation can delete read-only files just fine.
"Thumbs.db" files, if I'm not mistaken, are considered system files.
Windows Explorer might be able to deal with them just fine through "special"
means, but my guess is that "ordinary" apps might have trouble with them.
That's just purely speculative.

--
Mike
Microsoft MVP Visual Basic


Galen Somerville

2005-11-27, 9:55 pm


"MikeD" <nobody@nowhere.edu> wrote in message
news:OPGB0h68FHA.1140@tk2msftngp13.phx.gbl...
>
> "Galen Somerville" <galen@surewest.net> wrote in message
> news:eRQQVP58FHA.2364@TK2MSFTNGP12.phx.gbl...
>
>
> Possibly, but I think SHFileOperation can delete read-only files just

fine.
> "Thumbs.db" files, if I'm not mistaken, are considered system files.
> Windows Explorer might be able to deal with them just fine through

"special"
> means, but my guess is that "ordinary" apps might have trouble with them.
> That's just purely speculative.
>
> --
> Mike
> Microsoft MVP Visual Basic
>
>

FWIW My 4 read only's were also Hidden. None were System.

Galen


iatethewholething

2006-09-21, 2:51 am

SHFileOperation has some funky return values from the DOS days that do not match system error codes. See the below blog post for a description of the error codes:

http://shellrevealed.com/blogs/shel...00_-Part-1.aspx
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com