How to close a file in Autocad using C# keeping acad.exe running?

后端 未结 6 1611
执念已碎
执念已碎 2020-12-19 19:32

I am using visual studio 2010 and I am having a .DWG file which I want to open in autocad. Till now I have used this.

Process p = new Process();
ProcessStart         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-19 20:13

    There is one other possibility - this will only work if your C# code is running on the same machine as the AutoCAD process and it is not really recommended, but, if you are really stuck and are prepared to put up with the hassle of window switching you can send key strokes to an application using the SendKeys command.

    MSDN articles here: http://msdn.microsoft.com/EN-US/library/ms171548(v=VS.110,d=hv.2).aspx http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx

    Using this you could send the key strokes to simulate the user using the menu commands to close the file.

提交回复
热议问题