Message 1 of 3
Check if drawing is open by another user *before opening*? VB.NET
Not applicable
10-18-2006
06:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there a way to check if a file is open by another user before you open
it? I know once a file is open, I can use the ThisDrawing.ReadOnly property
to check it. I was just trying to save some time by not having to open a
drawing before processing it.
There doesn't seem to be a property under System.IO.File to handle this.
I've tried this code:
Public Shared Function IsFileOpen(ByVal filename As String) As Boolean
Try
System.IO.File.Open(filename, IO.FileMode.Open,IO.FileAccess.Read,
IO.FileShare.None)
FileClose(1)
Return False
Catch ex As Exception
Return True
End Try
End Function
But it seems to change the properies of the drawing so AutoCAD won't open
it. Any help would be appreciated!
it? I know once a file is open, I can use the ThisDrawing.ReadOnly property
to check it. I was just trying to save some time by not having to open a
drawing before processing it.
There doesn't seem to be a property under System.IO.File to handle this.
I've tried this code:
Public Shared Function IsFileOpen(ByVal filename As String) As Boolean
Try
System.IO.File.Open(filename, IO.FileMode.Open,IO.FileAccess.Read,
IO.FileShare.None)
FileClose(1)
Return False
Catch ex As Exception
Return True
End Try
End Function
But it seems to change the properies of the drawing so AutoCAD won't open
it. Any help would be appreciated!