INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Multiple Autocad Instance VB6 control Application

Multiple Autocad Instance VB6 control Application

(OP)
I have a VB app that looks at autocad to determine if a dwg is open. I have run into a problem if the user has more than one instance of Autocad running or if the dwg that is open still has an open command running such as Pan. This throws up a message and has an adverse affect on my app. With all that my question would be how do I loop through all the instances of Autocad. This is my code to loop through the dwg files to determine if it is open. If it is a message will inform them to save and close the file before my app can "Check the file in" or back to the server. Wasn't sure where to post this. Oh and I also need to pass either a Ctrl+C or an Escape character to each file to terminate any active commands.

Public Function AcadLink() As Boolean
  Dim h, i As Integer
  Dim DwgName As String
  
  i = 0
  AcadLink = False
  On Error GoTo nocad
  
  Set AcadApp = GetObject(, "AutoCAD.Application")
  For i = 0 To AcadApp.Documents.Count - 1
    DwgName = Left(Right(AcadApp.Documents(i).Name, Len(lstCitem) + 4), Len(lstCitem))
    If lstCitem = DwgName Then
      AcadLink = True
      Exit For
    End If
  Next i
nocad:

End Function

Thanks
 

RE: Multiple Autocad Instance VB6 control Application

Hi Irfcbabe,

This probably won't be of much help, but I'm not sure VB is capable of collecting a list of running applications, the problem is the application class doesn't change, and neither does the path of the application.  You'll need to look to the WindowsAPI to do what you need for that - start here: http://msdn.microsoft.com/en-us/library/e9waz863%28v=vs.71%29.aspx


The really tough issue here is trying to send in an ESC sequence or a Ctrl C.  AutoCAD typically doesn't accept any incoming commands while a command is processing - in this sense - it's single threaded (it's not but the sake of argument - you get the idea).  Most of our AutoCAD automation is forced to wait until AutoCAD allows commands in - maybe the WinAPI will offer you something here I'm not sure...

Sorry the news isn't better - maybe someone else will chime in here with better info...   

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close