"Fungus" <fungus@daimi.au.dk> wrote in message news:<3ba87a84$0$4795$ba624c82@nntp01.dk.telia.net>...
> Kan man fra C, på en windows platform, låse en fil således at den ikke kan
> kopieres
> mens den benyttes.
>
> Renè
Du kan bruge CreateFile() og angive 0 for "dwShareMode" jvf. MSDN:
HANDLE CreateFile(
LPCTSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDispostion ,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile);
[snip]
dwShareMode
[in] Specifies how the object can be shared. If dwShareMode is 0, the
object cannot be shared. Subsequent open operations on the object will
fail, until the handle is closed.
To share the object, use a combination of one or more of the following
values:
Value Description
FILE_SHARE_READ Subsequent open operations on the object will succeed
only if read access is requested.
FILE_SHARE_WRITE Subsequent open operations on the object will succeed
only if write access is requested.
[snip]
mvh,
S. Bro
|