.NET

Reply
Mentor
amitk_189
Posts: 219
Registered: ‎12-15-2011
Message 1 of 8 (317 Views)
Accepted Solution

Suppress Messages

317 Views, 7 Replies
08-21-2012 11:34 PM

Is there a way to suppress the message boxes given by autocad, such as Drawing file recovery. We are doing a project where this message stops execution of code every time

 

Valued Contributor
FFlix
Posts: 95
Registered: ‎11-15-2011
Message 2 of 8 (309 Views)

Re: Suppress Messages

08-22-2012 01:19 AM in reply to: amitk_189

hi

 

with regards to drawing recovery at least, try setting the RECOVERYMODE system variable to 0 or 1:

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a91938...

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html (under 'set and return system variables')

 

hope this is of use

Mentor
amitk_189
Posts: 219
Registered: ‎12-15-2011
Message 3 of 8 (303 Views)

Re: Suppress Messages

08-22-2012 04:49 AM in reply to: amitk_189

But How do i control these issues through code?

 

With Warm Regards

Amit

Valued Contributor
FFlix
Posts: 95
Registered: ‎11-15-2011
Message 4 of 8 (293 Views)

Re: Suppress Messages

08-22-2012 06:30 AM in reply to: amitk_189

sorry if my post wasn't clear or if i missunderstood; based on the section 'set and return system variables' of the developer's guide (2nd link):

 

Dim nMaxSort as Integer = Application.GetSystemVariable("RECOVERYMODE")

Application.SetSystemVariable("RECOVERYMODE", 1) 

 

as a result, "the Drawing Recovery window does not display automatically" (1st link).

 

(if what you're looking for is a way of programmatically handling [any] acad messagebox events, say on opening acad, i have to pass)

Mentor
amitk_189
Posts: 219
Registered: ‎12-15-2011
Message 5 of 8 (260 Views)

Re: Suppress Messages

08-22-2012 09:09 PM in reply to: amitk_189

My current code is using the concept of Latebinding and Multithreading, will this work if i incorporate this logic.

 

With Warm Regards

Amit

*Expert Elite*
Hallex
Posts: 1,554
Registered: ‎10-08-2008
Message 6 of 8 (241 Views)

Re: Suppress Messages

08-23-2012 08:12 AM in reply to: amitk_189

Add this function

   

    Public Shared Sub SetVar(owner As Object, varname As String, value As Object)
        Dim args As Object() = New Object() {varname, value}
        owner.GetType().InvokeMember("SetVariable", Reflection.BindingFlags.InvokeMethod Or Reflection.BindingFlags.IgnoreCase, _
                        Nothing, _
                        owner, _
                        args)

    End Sub

  

Then inside your calling Sub add this line

after you have a got activedocument

 

       AcDoc = AcadApp.GetType.InvokeMember( _

        "ActiveDocument", BindingFlags.GetProperty,

Nothing, AcadApp, Nothing, Nothing)

            SetVar(AcDoc, "regenmode", 1)

 

Restore variable at the end of work with active document

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Mentor
amitk_189
Posts: 219
Registered: ‎12-15-2011
Message 7 of 8 (224 Views)

Re: Suppress Messages

08-24-2012 03:12 AM in reply to: amitk_189

Thanks Hallex, this logic resolved the bug.

Thanks a lot Hallex

*Expert Elite*
Hallex
Posts: 1,554
Registered: ‎10-08-2008
Message 8 of 8 (176 Views)

Re: Suppress Messages

08-26-2012 11:24 AM in reply to: amitk_189

You're quietly welcome

Happy coding :smileyhappy:

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community