Hi,

I was wondering about how to prevent people from opening 2 copies of the files. I searched the forums and found nothing related to the subject. Hope someone will come or have some nice methods of preventing such things from happening.
Posted on 2002-06-13 07:49:53 by roticv


dwShareMode
[in] Sharing options. If dwShareMode is zero and CreateFile succeeds,
[color=blue]the object cannot be shared and cannot be opened again until
the handle is closed.[/color] Please refer the information concerning
sharing violations in the Remarks section.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fileref_7wmd.asp
Posted on 2002-06-13 08:10:03 by bazik
Thanks Bazik,

Just a thought, what will happened when you use CreateFile api with the shared mode set to 0 and you attempt to open it again?
Posted on 2002-06-13 08:52:38 by roticv
until the handle is closed, the file cannot be opened again... causes sharing violation.
Posted on 2002-06-13 08:59:55 by jademtech
The function returns INVALID_HANDLE_VALUE(-1). Whatelse could it be?
Posted on 2002-06-13 09:00:02 by C.Z.