1.- Register my dll in register, so it will automatically run with Autocad startup.
-----------------------------
Simplist way is to just create a lisp file with
(command "netload" "c:\\MyDll.dll")
and add it to the startup Suite Contents.
2. - Write LISP function in acad.lsp, that will launch some function from my dll. For this I need to send some parameters into autocad on startup and I don't know how to do it? Is it possible to send parameters to Autocad from cmd.exe?
---------------------------
You don't use lisp to send commands.
You use the CommandMethod to define the commands
{code}
*GreaterThan*CommandMethod("HelloWorld", CommandFlags.Modal)*LessThan* _
Public Sub someSubName()
end sub
{code}
If you want to make a lisp Style Command, (myCommand Value1 value2), you can use;
{code}
*GreaterThan*LispFunction("HelloWorld")*LessThan* _
Public Sub someSubName(ByVal rbArgs As ResultBuffer)
For Each item As Object In rbArgs
MsgBox(item.value.ToString)
Next
End Sub
{code}
3. - Write LISP function in acad.lsp, that will launch some function from my dll. For this I need to send some parameters into autocad on startup and I don't know how to do it? Is it possible to send parameters to Autocad from cmd.exe?
----------------------------
If you want to send a parameter such as a filename
from cmd.exe you would have to use COM.
You can't use this as a dll. You would make an EXE.
This is a stand alone application that takes the file names
and adds them to a list on a form.
You would then need to take this list and pass it to AutoCAD.
Sample is Below.
I already posted a sample of how to access AutoCAD from COM here
http://discussion.autodesk.com/forums/thread.jspa?messageID=6212728�
{code}
Namespace My
' The following events are available for MyApplication:
'
' Startup: Raised when the application starts, before the startup form is created.
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled exception.
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
Partial Friend Class MyApplication
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
Try
Dim strFileName As String = LongName.GetLongPathName(e.CommandLine(0))
Dim intCount = e.CommandLine.Count
AddtoList(strFileName, intCount)
Catch ex As Exception
End Try
End Sub
Private Sub MyApplication_StartupNextInstance(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
Try
Dim strFileName As String = LongName.GetLongPathName(e.CommandLine(0))
Dim intCount = e.CommandLine.Count
AddtoList(strFileName, intCount)
Catch ex As Exception
End Try
End Sub
Private Sub AddtoList(ByVal strFileName As String, ByVal intCount As Integer)
If intCount > 0 Then
If UCase(strFileName.Substring((Len(strFileName) - 4), 4)) = UCase(".dwg") Then
If Not isDWGDuplicate(strFileName) Then
MyForm.lstFiles.Items.Add(strFileName)
End If
End If
End If
End Sub
Public Function isDWGDuplicate(ByVal strValue As String) As Boolean
Dim i As Long
If MyForm.lstFiles.Items.Count > 0 Then
For i = 0 To MyForm.lstFiles.Items.Count - 1
If UCase(strValue) = UCase(MyProgram.lstFiles.Items(i)) Then
Return True
Exit For
End If
Next
End If
End Function
End Class
End Namespace
{code}
---------------------------

(defun botsbuildbots() (botsbuildbots))