- 0
[VB.NET] Delete File in process
Asked by
James Rose,
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By adrynalyne · Posted
So it’s fine he scams people? -
By matthiew · Posted
That explains my recent issues with classic Outlook. I can see the FORMS2 folder has resolved the issue on my system. -
By Copernic · Posted
Brave 1.79.126 by Razvan Serea Brave Browser is a lightning-fast, secure web browser that stands out from the competition with its focus on privacy, security, and speed. With features like HTTPS Everywhere and built-in tracker blocking, Brave keeps your online activities safe from prying eyes. Brave is one of the safest browsers on the market today. It blocks third-party data storage. It protects from browser fingerprinting. And it does all this by default. Speed - Brave is built on Chromium, the same technology that powers Google Chrome, and is optimized for speed, providing a fast and responsive browsing experience. Brave Browser also features Brave Rewards, a system that rewards users with Basic Attention Tokens (BAT) for viewing opt-in ads. This innovative system provides an alternative revenue model for content creators and a way to support the Brave community. Brave 1.79.126 changelog: Fixed crash when clicking on shields panel in certain cases. Fixed crash on navigation when a Google sign-in request has been triggered. (#46769) Fixed crash when Leo generates empty list when clicking on “Suggest questions” while using BYOM (Bring Your Own Model). (#46843) Fixed issue importing from Trezor wallet when Trezor Connect is outdated. (#46660) Upgraded Chromium to 137.0.7151.119. (#46911) Download: Brave Browser 64-bit | 1.2 MB (Freeware) Download: Brave Browser 32-bit View: Brave Homepage | Offline Installers | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware -
By Copernic · Posted
LeafView 3.6.5 by Razvan Serea LeafView is a fast, open-source image viewer built with Electron. It offers a sleek, minimal UI for fast and efficient image browsing. Supporting various formats, LeafView ensures a smooth viewing experience with essential features like zoom, rotation, and slideshow mode. Designed for simplicity and performance, it utilizes hardware acceleration for smooth rendering and supports touch gestures for seamless navigation. LeafView key features: Lightweight & Open-Source – Minimal resource usage with a clean, efficient design Electron-Based – Cross-platform compatibility with modern UI Multiple Image Format Support – Opens JPG, PNG, GIF, BMP, and more Smooth Rendering – Hardware acceleration for fast performance Essential Image Controls – Zoom, rotate, and slideshow mode Touch Gesture Support – Seamless navigation on compatible devices Minimal UI – Focused on simplicity and ease of use LeafView 3.6.5 changelog: Update electron to v36.5.0 Download: LeafView 3.6.5 | Portable | ~100.0 MB (Open Source) View: LeafView Website | Other operating systems | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware -
By naap51stang · Posted
Which is why I continue to use Open Shell for my start menu. your best course of action is to install a third-party Start menu
-
-
Recent Achievements
-
Fuzz_c earned a badge
First Post
-
TIGOSS earned a badge
First Post
-
slackerzz earned a badge
Week One Done
-
vivetool earned a badge
Week One Done
-
pnajbar earned a badge
Reacting Well
-
-
Popular Contributors
-
Tell a friend
Question
James Rose
Ok gang,
I've got an interesting problem. I have a .net 2.0 app that goes off to a server to get a file and unzip it locally. This process is threaded. It's possible that during the first run through the process the end-user may need to stop the original process and go get a different file.
So, I abort the initial thread and start over. The issue? (Glad you asked) Seems that one or more files (the zip and possibly files from within the zip file, depending on how far along the initial process is) will not delete (File.Delete(path) as these files are in use my another process.
Exact error:
Description: The process cannot access the file 'c:\TestExtract\75872-01-1.ado' because it is being used by another process.
The code that is pulling the file from the zip is here:
--- BEGIN CODE CHUNK --------
If (sFileName <> String.Empty) Then
Dim StreamWriter As FileStream = File.Create(sDirectory & theEntry.Name)
Dim Size As Integer = 2048
Dim data(2048) As Byte
While (True)
Size = stmZipFile.Read(data, 0, data.Length)
If (Size > 0) Then
StreamWriter.Write(data, 0, Size)
Else
Exit While
End If
End While
StreamWriter.Close()
End If
--- END OF CODE CHUNK --------
Ive tried watching for the thread's abort request in that loop, but it never gets it. So I can't close the stream (arg)
I've looked to see if I can get the handle of the process that is using the file so I can kill the process and then the file... but so far no luck. I'm heading home now, but I'll check back in a few hours (it's 5pm est)
Thanks for any ideas.
Link to comment
https://www.neowin.net/forum/topic/578013-vbnet-delete-file-in-process/Share on other sites
4 answers to this question
Recommended Posts