473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

unlock file, close handle, kill process that holds it?

Hi. I am writing an app that updates a certain windows service that is
had previously installed.
It stops the service, rewrites the file, and starts it again.
On some machines, however, even though the service is stopped, I am
getting "being used by another process" error. I wonder if there's any
pre-made class in .NET framework or some third-party component that
would close the handle to this file from whichever process, or kill
offending process altogether; e.g. unlock the file no matter what?

I am contemplating using WinApi to accomplish this, but I think it
might be reinventing the wheel...
Dec 11 '07 #1
0 2198

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: darkhorse | last post by:
Hi all, While doing a quite big "set of programs" for a university subject I've found myself in the middle of a problem someone surely has had before, so I'm looking for some help. At one...
0
by: John | last post by:
I've got multiple threads and processes that write to same file. Before writing all threads / processes first lock part of file and then write to file. If one thread / process locks file, another...
0
by: Bohus | last post by:
I want that my thread sleeps until file is unlocked, but if I wait for signaled state of FileStream handle, it does not work and ARE.WaitOne() function returns immediately, even if file is locked...
5
by: Viper | last post by:
.... say, like MS Word opens another instance of himself when you open another document. If you close the first 'Word', the second document remains alive. I can't figure out how to do the same...
1
by: Joshua T. Moore | last post by:
If application A sends a Process.Close message to application B, is there an event handler in application B to handle it? The problem is that application A sends the close message to application...
5
by: Wayne Wengert | last post by:
I want to have my application (VB.NET) check a table on an SQL server to see if there is a newer version released and, if so, download and install the new version. I know how to setup the database...
1
by: tshad | last post by:
I am opening a file in my .aspx page like so: // Pass the file path and the file name to the StreamWriter constructor. objStreamWriter = new StreamWriter(Server.MapPath("Employee.txt")); If...
1
by: brogdon | last post by:
I'm attempting to build an ASP.NET (VB) application that will do server-side printing of PDF files. I have used a Process object to launch Adobe's AcroRd32 program with the /t switch which causes...
2
by: revenant81 | last post by:
I'm writing a program which has to execute a command, get its output and show it on a treeview. This command runs for a very long time. I want to end the execution of the command when the user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.