.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to dispaly a msgbox everytime I make a drawing active

5 REPLIES 5
Reply
Message 1 of 6
dancalgary
326 Views, 5 Replies

How to dispaly a msgbox everytime I make a drawing active

I am new in .net
I just want everytime when I make a drawing active to display a message box.
Can somebody give me a sample.
I am talking about a dll application
Thanks
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: dancalgary

Create a class that implements the IExtensionApplication. In the Initialize
method you have access to the DocumentManager class. That class has events
that allow you to monitor when documents are opened, closed, and activated.

As a side note, have you a palette instead of a message box? As a user, I'd
prefer something a little less 'in your face'.
--
Bobby C. Jones
http://bobbycjones.spaces.live.com


wrote in message news:6272873@discussion.autodesk.com...
I am new in .net
I just want everytime when I make a drawing active to display a message box.
Can somebody give me a sample.
I am talking about a dll application
Thanks
Message 3 of 6
arcticad
in reply to: dancalgary

Bobby, Can you please show some code on how to implement IExtensionApplication

I'm trying to make a Palette only show up in certain drawings such as the REFEDIT does.

Thank You
---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 4 of 6
sdphg
in reply to: dancalgary

I think you should regist the Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.DocumentActivated event handler. This event will be fired every document actived. You can display the mesgbox in it.

Message 5 of 6
danny.boy.1
in reply to: dancalgary

Hello,

Try this code, I am not sure is it the best way..but it seems to work.


{code}

Imports Autodesk.AutoCAD.Runtime


Public Class AutoLoad

Implements Autodesk.AutoCAD.Runtime.IExtensionApplication


Public Sub Initialize() Implements IExtensionApplication.Initialize

AddHandler Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.DocumentActivated, AddressOf ActivatedMessage

End Sub

Public Sub Terminate() Implements IExtensionApplication.Terminate

End Sub

Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub

Public Sub ActivatedMessage()

MsgBox("Hello!", MsgBoxStyle.Information, "Info")

End Sub

{code}
Message 6 of 6
dancalgary
in reply to: dancalgary

I have a problem
if I put instead of
MsgBox("Hello!", MsgBoxStyle.Information, "Info")
the following:
Dim Current1 As Autodesk.Gis.Map.MapApplication
Current1 = Autodesk.Gis.Map.HostMapApplicationServices.Application
Dim Project1 As Autodesk.Gis.Map.Project.ProjectModel
Proiect1 = Current1.ActiveProject
msgbox(project1.projection.tostring)

I have an error at line: current1 = current1.activeproject

because active project is not set up yet
I would like this to run at the end of the activation of the drawing

Can somebody help me?
Thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost