The move trick doesnt work in vista :( On Wed, Apr 8, 2009 at 8:50 PM, santhosh vs <[email protected]> wrote:
> Thanks for the replay. What i want is why explorer locks it for such an > infinite time, any idea? > > > On Wed, Apr 8, 2009 at 4:30 PM, AstroDrabb <[email protected]> wrote: > >> >> On Mon, Apr 6, 2009 at 2:29 AM, santhosh vs <[email protected]> >> wrote: >> > Hi all, >> > Now iam developing an application in vista and iam experiencing one >> strange >> > issue. >> > The application suddenly refused to remove a file from user's temp >> folder. >> > It was a video file and hence i thought some issue with my code and lost >> my >> > 2 days working on it. Finally i decided to execute an older version >> which >> > worked early, but found the same issue again. >> > The file wont be deleted and it cant even delete through explorer (the >> steps >> > are funny , windows will ask do u want to delete the file , on yes the >> file >> > will disappear and appear agian! no message from windows that the file >> is >> > locked). On using 'unlocker' i found multiple locks from explorer. >> > After some research in this issue i found that vista automatically apply >> > indexing service. >> > I decided to turn it off for the users private folders (that includes >> temp) >> > , i was not sure that this was making the lock. >> > But with surprise the issue gone and i can now delete the file!! >> > My question is any one experienced this problem before? >> > Any idea to delete file in such cases when an indexing is applied to the >> > user folder and why vista locks files/folders for indexing ...? >> >> This is nothing new. It has been going on for a long time with >> explorer.exe the command shell. >> I am still using XP for my dev box and it is stable except for the >> locking crap from explorer.exe. >> Unlocker is great for things like this. >> >> I think you came up with your own answer. The indexing service is >> locking the file, though >> I think the explorer shell does it just as much. If I open a dir of >> images or videos (I have >> indexing turned off) I still get locking issues from explorer.exe. Sigh. >> >> You can code your app to spawn a thread to wait X secs/mins for the >> lock to be released >> and to keep trying to delete it. Or you can use a Win32 API to delete >> the files. >> >> A way to delete a locked/in use file with Win32 is with MoveFileEx(): >> http://msdn.microsoft.com/en-us/library/aa365240(VS.85).aspx<http://msdn.microsoft.com/en-us/library/aa365240%28VS.85%29.aspx> >> >> Here are some other ways: >> >> http://stackoverflow.com/questions/1040/how-do-i-delete-a-file-which-is-locked-by-another-process-in-c >> >> Jim >> > > > > -- > My Web Site > http://everlovingyouth.googlepages.com > My Technical Blog > http://acutedeveloper.blogspot.com > Skype :santhoshnta > Orkut :everlovingyouth > -- My Web Site http://everlovingyouth.googlepages.com My Technical Blog http://acutedeveloper.blogspot.com Skype :santhoshnta Orkut :everlovingyouth
