External start CAD

Source: Internet
Author: User
Static void main (string [] ARGs) {// connect to the AutoCAD application registrykey regk = registry. localmachine; registrykey software = regk. opensubkey ("Software \ Autodesk \ AutoCAD \ r17.1", false); If (software = NULL) {console. writeline ("AutoCAD 2008 startup failed! "); Return;} // determine whether the registry file already exists // If (isreg) // {console. writeline ("the Registry file already exists, and AutoCAD 2008 starts normally .. "); // 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 ("Events", 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; // whether the registry file contains 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 ;}}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.