p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   General .NET (http://p2p.wrox.com/forumdisplay.php?f=122)
-   -   Know about a running process for a given resource (http://p2p.wrox.com/showthread.php?t=30179)

baburman June 7th, 2005 08:35 AM

Know about a running process for a given resource
 
Hi guys,

Anybody knows about how to get to know about the OS process under which a given resource (e.g, a disk file) is in use? I am working in Windows .NET app, however no matter if the code example uses Windows APIs in language like vb/vc++. This is very important for me so early rply will be highly appreciated. thanx in advance.

BaburMan

planoie June 9th, 2005 07:03 AM

Are you specifically looking for a way to monitor changes to a file? There are classes that provide file watching capabilities in .NET.

-Peter

baburman October 13th, 2005 03:04 AM

Sorry for the late reply, i was busy in some other tasks and in the meantime i have also been trying to get solution from Win32 APIs. Let me explain it in some details. I have placed a
web browse control in my Windows Form in order to show many types of documents like word doc,
text file, ms excel sheet, images or even flash animation etc. There are three panels in this
Form. On the left panel there's a Directory tree just like we see in Windows Explorer. The Top panel contains a list of documents in the currently selected directory. I have placed the web
browser control in the third panle which is right below the top panel. When the user selects
a document (word, excel etc.) it is opened and viewed in the browser control. So far so good.
Now the problem occurs when the user selects a document and it opens for view and he
wants to delete it by using the shortcut menu option which is provided by me. The system throws
an exception when i attempt to delete this document from the os directory and says like "The file is in use by another process.". This occurs even if the user selects another document and the
application attempts to delete the 'previously' selected document again. This is for sure that
the process which is running my app has not yet destroyed the handle of the document, but i
don't know how to destory it in order to delete the file.



BaburMan


All times are GMT -4. The time now is 11:41 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.