is drawing open?

Discussion in 'AutoCAD' started by mark, Feb 2, 2004.

  1. mark

    mark Guest

    hello all,

    what is the way to check thru VB6, to see
    if a drawing is open in a drawing editor,
    Scripting.FileSystemObject, does not seem
    to do the job.

    TIA
     
    mark, Feb 2, 2004
    #1
  2. Try GetObject using the path to the desired file. Be sure to enable
    error handling

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)
     
    Frank Oquendo, Feb 2, 2004
    #2
  3. mark

    mark Guest

    the getfile, attributes will work, if the file is read-only,
    but if the file is open by a user, it will not report it as RO...

    what i came up with is to search fso.fileexists(filename.dwl)
    the corresponding lock file of an open drawing, works fine,
    any drawbacks?

    what i am trying to do is to color in red, the drawing names
    in a VB6 filelistbox, all that are open by another user.

    thanks
    mark
     
    mark, Feb 2, 2004
    #3
  4. Not every version of AutoCAD uses lock files so your solution isn't
    backward compatible. It also requires another level of abstraction in
    the use of the FileSystemObject when you could just go direct with
    GetObject as it is native to VBA.
    VB6 lets you change the color of individual line items in a list box?
    Even if you find a way to do this, from an end-user POV an option I
    don't know I have is better than one I'm aware of and cannot access.

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)
     
    Frank Oquendo, Feb 2, 2004
    #4
  5. Use either a treeview or an imageview instead of a listbox and use
    different images for locked, unlocked, etc.
    ___________________________
    Mike Tuersley
    CADalyst's AutoCAD Clinic
    Rand IMAGINiT Technologies
     
    Mike Tuersley, Feb 3, 2004
    #5
  6. I've used this with sme success:

    Public Function IsDwgOpen(fn As String) As Boolean
    'returns true if a drawing is open already or read-only
    On Error GoTo ERROPEN
    Dim ff As Integer
    If fn = "" Then
    IsDwgOpen = False
    Exit Function
    End If
    ff = FreeFile
    Open fn For Binary Access Write Shared As ff
    Close ff
    IsDwgOpen = False
    Exit Function
    ERROPEN:
    IsDwgOpen = True
    End Function
     
    michael montagne, Feb 4, 2004
    #6
  7. mark

    mark Guest

    makes sense,
    thanks
    mark

     
    mark, Feb 5, 2004
    #7
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 (here). After that, you can post your question and our members will help you out.