Please Help! How I can know that file is in use

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using VC++
in my application I create file every second and save on the disk
at the same time another appl reads this file every second from the disk
How I can know that file is in use.

thank yo
 
Hello,

Thanks for your post. As I understand, you want to know whether a file is
being opened in a programmatic way. Please correct me if there is any
misunderstanding.

You can use WMI to query if a file is opened in a process. Please refer to
the following sample code in another similar thread:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&frame=right&th=6
e7731fc0b1ca277&seekm=%23YHW0f17DHA.1936%40TK2MSFTNGP12.phx.gbl#link7

In addition, it would be best to post WMI questions in the following
newsgroup:
Microsoft.public.win32.programmer.wmi

Does this anwer your question?

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
The problem is
that in my application(VC++) I create file every second and save on the disk
at the same time Internet Explorer page reads this file every second from the disk
How I can know that file is in use in my appl in VC++?

thank you
 
Create a lock file that will let you know whether your application has the
file open. So everytime you get ready to load the file check first if a
..lck file exists before opening.
 
Hi,

Thanks for your response.

If you want to know whether or not a file is opened in local application,
you can check the file handle, or use a boolean variable to flag the use of
file, or create a lock file as suggested by Bryan.

If you want to check a file beeing used in another process, I recommend you
use WMI as described in my previous reply.

Please feel free to let me know if you have any problems or concerns.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi,

I wanted to post a quick note to see if you would like additional
assistance or information regarding this particular issue. We appreciate
your patience and look forward to hearing from you!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top