Solved

Automation

Posted on 1999-01-25
3
208 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now