Thanks guys, I got it to work. But now how do I release the dll from memory?
Matthew
wrote in message news:4910970@discussion.autodesk.com...
To strongly name your assembly see
http://andrewconnell.com/blog/archive/2004/12/15/772.aspx
You can wrap com around dotnet and use it from lisp, it works just fine. It
beats the heck out of using DCL or VBA for forms.
I used it from lisp to kick a splash screen and get the CLR up and running.
Here is some VB.net code created as a new class and called
AmerXSplashScreen. I have blanked out the GUID's so they don't conflict
with my com object, so you will have to generate your own in the dotnet UI.
Be sure you have "Register for COM Interop" checked on the build tab.
You can strongly name the assembly and install it to the GAC so Autocad can
find it, or you can copy the assembly to the Autocad Program directory (good
for quick development).
Option Strict On
Option Explicit On
Imports System.Runtime.InteropServices
AmerXSplashScreen.EventsId)> _
Public Class AmerXSplashScreen
Implements IDisposable
' Track whether Dispose has been called.
Private mDisposed As Boolean = False
Private mFSplash As FSplashScreen
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
' NOTE: I have blanked these out, get your own id's from the UI
Public Const ClassId As String = "********-9B28-4A2C-BBCF-0B18F857A791"
Public Const InterfaceId As String =
"********-42EC-49FD-875C-91072BE5B18A"
Public Const EventsId As String = "********-A458-48AD-83C8-36B6FE589DF7"
#End Region
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
' Show the splash screen to the world. Will kick the CLR as a side
benifit
Public Sub Show()
Try
mFSplash = New FSplashScreen()
With mFSplash
.ShowDialog()
End With
Catch ex As Exception
Trace.Fail(ex.Message, ex.StackTrace)
End Try
End Sub
' Implement IDisposable.
' Do not make this method virtual.
' A derived class should not be able to override this method.
Public Overloads Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
' This object will be cleaned up by the Dispose method.
' Therefore, you should call GC.SupressFinalize to
' take this object off the finalization queue
' and prevent finalization code for this object
' from executing a second time.
GC.SuppressFinalize(Me)
End Sub
' Dispose(bool disposing) executes in two distinct scenarios.
' If disposing equals true, the method has been called directly
' or indirectly by a user's code. Managed and unmanaged resources
' can be disposed.
' If disposing equals false, the method has been called by the
' runtime from inside the finalizer and you should not reference
' other objects. Only unmanaged resources can be disposed.
Private Overloads Sub Dispose(ByVal disposing As Boolean)
' Check to see if Dispose has already been called.
If Not Me.mDisposed Then
' If disposing equals true, dispose all managed
' and unmanaged resources.
If disposing Then
'Dispose of all child .NET objects here
If Not mFSplash Is Nothing Then
mFSplash.Dispose()
End If
End If
' Call the appropriate methods to clean up
' unmanaged resources here.
' If disposing is false,
' only the following code is executed.
' Release any memory held outside of the CLR
'Because the CLR is not always running when called from an ARX,
'Force a GC, will not get another chance later.
'NOTE!! only call this from the main dispose method of the COM
object. DO NOT call
'in the child dispose methods.
GC.Collect()
End If
'Mark disposed to indicate that we are done, prevent us from
disposing twice.
mDisposed = True
End Sub
' This finalizer will run only if the Dispose method
' does not get called.
' It gives your base class the opportunity to finalize.
' Do not provide finalize methods in types derived from this class.
Protected Overrides Sub Finalize()
' Do not re-create Dispose clean-up code here.
' Calling Dispose(false) is optimal in terms of
' readability and maintainability.
Dispose(False)
MyBase.Finalize()
End Sub
End Class