Solved

Automation

Posted on 1999-01-25
3
213 Views
Last Modified: 2010-05-03
I have a VB6 app that from titme to time tries to read an AutoCAD drawing to check that the name is the same. However if AutoCAD is busy, I get an error generated by either AutoCAD or windows asking me to cancel or try again. This doesn't always work but in any case interrupts what I am doing in AutoCAD. Error trapping in VB6 doesn't seem to work. How can I test if AutoCAD is busy before trying to read drawing.
0
Comment
Question by:broadbent
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 100 total points
ID: 1470562
Have it attempt to rename the drawing and that should only succeed if the drawing file is idle.

Also, AutoCAD creates a working file with the same base name as the drawing while it's active. This is a good indicator that the primary .DWG is in use. I think it's called *.DWK but don't bet the farm on it.

M

0
 
LVL 4

Author Comment

by:broadbent
ID: 1470563
Renaming is simple and it works. Thanks.
AutoCAD uses .dwk extensions to signify lock files which can be disabled by the user.
Actually the elegant way (someone else gave me) is to error trap the call using
app.OleServerBusyRaiseError = True
app.OleServerBusyTimeout = 100

thanks anyway and welcome to the points
0
 
LVL 4

Author Comment

by:broadbent
ID: 1470564
Further comment:
Renaming only tests if AutoCAD has loaded the drawing, not whether AutoCAD is busy or not.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question