zoukankan      html  css  js  c++  java
  • 外部启动CAD

     static void Main(string[] args)
            {
                 // 连接至 AutoCAD 应用程序   
                RegistryKey RegK = Registry.LocalMachine;
                RegistryKey software = RegK.OpenSubKey("Software\\Autodesk\\AutoCAD\\R17.1", false);
    
                if (software == null)
                {
                    Console.WriteLine("AutoCAD 2008启动失败!");
                    return;
                }
                // 判断注册表文件是否已经存在
                //if (IsReg) 
                //{
                    Console.WriteLine("注册表文件已存在,AutoCAD 2008正常启动..");
                    //Console.ReadLine();
                    System.Type AcadType = System.Type.GetTypeFromProgID("AutoCAD.Application");
                    Object acad= System.Activator.CreateInstance(AcadType);
                    AcadType.InvokeMember("visible", System.Reflection.BindingFlags.SetProperty, null, acad, new object[] { true });
                    Object documents = AcadType.InvokeMember("Documents", System.Reflection.BindingFlags.GetProperty, null, acad, null);
                    Object document = documents.GetType().InvokeMember("Add", System.Reflection.BindingFlags.InvokeMethod, null, documents, null);
                    //Autodesk.AutoCAD.Interop.AcadApplicationClass ICad = new AcadApplicationClass();
                    //ICad.Visible = true;
                    //ICad.WindowState =Autodesk.AutoCAD.Interop.
                    //return;
                //} 
        }
            // 注册表文件是否存在
            static bool IsReg
            {
                get 
                {
                    RegistryKey Key = Registry.LocalMachine.OpenSubKey("Software\\Autodesk\\AutoCAD\\R17.1\\ACAD-6002:804\\Applications\\SmartSoft", false);
                    
                    if (Key == null)
                        return false;
    
                    Key.Close();
                    return true;
                }
            }             
            }
    

  • 相关阅读:
    hdu1879 继续畅通工程
    hdu1875 畅通工程再续 最小生成树并查集解决---kruskal
    hdu1863 畅通工程2 还是用并查集思想解决最小生成树问题
    hud2544dijkstra+堆优化
    PHP holiday1
    记忆化搜索hdu1078 dfs
    hdu 1548 楼梯 bfs或最短路 dijkstra
    隐藏原生html5 video controls
    工具网站gallery
    判断节点包含
  • 原文地址:https://www.cnblogs.com/chinaHunk/p/1931333.html
Copyright © 2011-2022 走看看