473,662 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to close an file in an running process from another process?

How to close an file in an running process from another
process?
For example:
There are two running processes,named procIn and
procFrom. A file
named needCloseFile was opened in procIn. Now I want to
close the
needCloseFile from procFrom by programming,but left
procIn running normally.
What can I do???
Thx for your reply!!

Nov 13 '06 #1
5 2019
What is the motive for that? I guest that would you like to open the file
from procFrom, and the system says it's begin used by other process, no? if
this is the case you can share the file between the 2 processes.

Regards,

Bela Istok

"xhy_China" <xu*********@gm ail.comwrote in message
news:11******** *************@i 42g2000cwa.goog legroups.com...
How to close an file in an running process from another
process?
For example:
There are two running processes,named procIn and
procFrom. A file
named needCloseFile was opened in procIn. Now I want to
close the
needCloseFile from procFrom by programming,but left
procIn running normally.
What can I do???
Thx for your reply!!
Nov 13 '06 #2
What is the motive for that? I guest that would you like to open the file
from procFrom, and the system says it's begin used by other process, no? if
this is the case you can share the file between the 2 processes.

No, I only want to know how to close ! !
Regards,

Bela Istok
Nov 14 '06 #3

"xhy_China" <xu*********@gm ail.comwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.com.. .
|
| What is the motive for that? I guest that would you like to open the
file
| from procFrom, and the system says it's begin used by other process, no?
if
| this is the case you can share the file between the 2 processes.
| >
|
|
| No, I only want to know how to close ! !
|

The simple answer is - you can't close a file you don't own, only the
process that has opened the file can close it.

Willy.
Nov 14 '06 #4

"Willy Denoyette [MVP] дµÀ£º
| What is the motive for that? I guest that would you like to open the
file
| from procFrom, and the system says it's begin used by other process, no?
if
| this is the case you can share the file between the 2 processes.
| >
| No, I only want to know how to close ! !
The simple answer is - you can't close a file you don't own, only the
process that has opened the file can close it.

but what does the software unlocker do after press the unlock button ?
It makes the file in using can be delete or move. how does it realize
this function???

Nov 14 '06 #5

"xhy_China" <xu*********@gm ail.comwrote in message
news:11******** **************@ h54g2000cwb.goo glegroups.com.. .

"Willy Denoyette [MVP] дµÀ£º
| What is the motive for that? I guest that would you like to open the
file
| from procFrom, and the system says it's begin used by other process,
no?
if
| this is the case you can share the file between the 2 processes.
| >
| No, I only want to know how to close ! !
The simple answer is - you can't close a file you don't own, only the
process that has opened the file can close it.

but what does the software unlocker do after press the unlock button ?
It makes the file in using can be delete or move. how does it realize
this function???

Well, "Unlockers" are tools that need high privileges (SeDebugPrivile ge) to
run and inject DLL's into the external process, they attach a filesystem
driver to delete the file under the other process feet.
Not something you can't (and should) do in managed code.

Willy.


Nov 14 '06 #6

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

Similar topics

1
2925
by: vaughn | last post by:
I'm trying to access a text file that was created by another process but I keep getting the contents of the file before the external process modified it. I believe the previous process left it open and doesn't let me access it. Is it possible for me to close the file before using in order to make sure that I have complete access? Even if it's not open, I'd like to make sure. Thanks.
14
1511
by: vbMark | last post by:
First this runs: static void Main() { ///////////////////// /// Don't let app run more than one instance. /// Process aProcess = Process.GetCurrentProcess();
2
1894
by: Bruce Wiebe | last post by:
hi all im having a problem accessing a text file on my hard disk after ive created it and added some text to it it would appear that the file is still locked. What happens is this i have three buttons on a windows form that provide three options for the user the process goes like this user clicks button one and a web service is called that dwnloads a list
2
5112
by: David | last post by:
I'm opening a cmd window to run an ftp process. It's easy enough to close the process (.close()), but the cmd window won't close unless I go out to the window and type 'quit'. How can I send a request to the cmd window to close? Here's the code snippet that I'm using to make the call: string strArg = "/c ftp.exe -v -n -s:" + strFile + " " + strHost + " > " + strLogFile;
10
10036
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to believe that this has to do with unreleased form component events or event handlers. I'm comparatively new to .net and windows forms, in the sense that though I've been using them for over 2 years now, it's been rather sporadic. I work with...
0
3180
by: Francois Stander | last post by:
ASP (VB.net) Good day. I re-use the same file name for sms information which gets uploaded to a FTP (sms) server. The file name is every time closed (seems this is not the case) When trying to re do this, an error is trapped that says the file is in use by another process. I checked the task manager after exiting out of the dot NET enviroment. The process causing this is ASPNET_WP.exe. This process I have to end several times as it seems like...
5
11207
by: Ryan Liu | last post by:
Hi, Both way works, I'd just ask some experts which way is better? My application creates a log file daily. Now each time when I write a log, I will open the file and append to the end. Ocz, if the file is not exist(e.g. another day), it will creates the file first.
0
2329
by: Mark Gold | last post by:
Hi! We have a VB application using Crystal Reports 6 that has worked successfully on hundreds of systems for over 10 years. Now, on one network, the application and access database does not close. It seems to hang on the command. When we open the application an peruse the screens without opening up a report (using crystal reports), the application and access db closes fine. But as soon as we run a report and then close the report and...
0
1847
by: Tim Golden | last post by:
aditya shukla wrote: Why on earth are you *specifying* c:\python25 as the directory for this file? It's automatically created in your user-specific temp directory which has specific permissions and is (obviously) specific to that user. You may -- depending on your needs -- also not need the suffix & prefix. ie, unless you have some specific need in mind, just use:
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8545
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.