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

Getting command-line parameters

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
jprisbe
1913 Views, 3 Replies

Getting command-line parameters

From my .NET dll I need to get the command line parameters that were used when AutoCAD was launched.

 

In the unmanaged world I used acedGetAcadWinApp.

 

Is there a .NET equivalent?

 

Thanks,

3 REPLIES 3
Message 2 of 4
chiefbraincloud
in reply to: jprisbe

Not that I am aware of.

 

It appears that acedGetAcadWinApp can be PInvoked, but I'm not sure how you would access the properties from the Pointer that is returned.

 

the signature for 32bit AutoCAD 2012 appears to be ?acedGetAcadWinApp@@YAPAVCWinApp@@XZ

Dave O.                                                                  Sig-Logos32.png
Message 3 of 4
SENL1362
in reply to: chiefbraincloud

       //"C:\Program Files\AutoCAD 20xx\acad.exe" /p "..\Acad.arg"    /myArg1 /nologo
        //Command: args
        //Arg0="D:\Program Files\AutoCAD 20xx.exe"
        //Arg1="/p"
        //Arg2="..\Acad.arg"
        //Arg3="/myArg1"
        //Arg4="/nologo"
        [CommandMethod("Args")]
        	public void GetAcadArguments()
        	{
            	Document dwg = Application.DocumentManager.MdiActiveDocument;
            	Editor ed = dwg.Editor;

                int i = 0;
                foreach (string arg in Environment.GetCommandLineArgs())
                {
                    ed.WriteMessage("\n Arg{0}=\"{1}\"",i++,arg);
                }

            }

 

Message 4 of 4
jprisbe
in reply to: jprisbe

Environment.GetCommandLineArgs() is exactly what I was looking for.

 

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