Data file only opened by 1 app.

G

Guest

Hi

In an app that I', writing, I would like to implement the similar to the
functionality in MS Word where Word detects wether a *.doc file has already
been opened in another instance of Word. I guess I would set some file
attribute like read-only or something on the file - however, does anyone know
of any other smart way to secure that a the same data file is only opened in
one instance of a program at a time.

Thanks.

Jesper.
 
K

Kerem Gümrükcü

Jesper said:
Hi

In an app that I', writing, I would like to implement the similar to the
functionality in MS Word where Word detects wether a *.doc file has
already
been opened in another instance of Word. I guess I would set some file
attribute like read-only or something on the file - however, does anyone
know
of any other smart way to secure that a the same data file is only opened
in
one instance of a program at a time.

Thanks.

Jesper.


Hi Jesper,

this depends on the "opening" application how it opens
the file. It can e.g. open the file with different FileShare-Modes.
Take a look at this:

[File.Open Method (String, FileMode, FileAccess, FileShare)]
http://msdn2.microsoft.com/en-us/library/y973b725.aspx

[FileShare Enumeration]
http://msdn2.microsoft.com/en-us/library/system.io.fileshare.aspx

This should be a good guide,...


Best regards

Kerem Gümrükcü
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top