Shell32.dll Control Network

Source: Internet
Author: User

        //Disable Setnetworkadapter (False)//enable Setnetworkadapter (True)//Add Reference System32/shell32.dll        Private Static BOOLSetnetworkadapter (BOOLstatus) {             Const stringDiscverb ="Deactivate (&b)";//"Deactivate (&b)";            Const stringConnverb ="enabled (&a)";//"enabled (&a)";            Const stringNetwork ="Network Connection";//"Network connection";            Const stringNetworkconnection ="VMware Network Adapter VMnet1";//"Local Area Connection"            stringSverb =NULL; if(status) {Sverb=Connverb; }             Else{Sverb=Discverb; } Shell32.shell SH=NewShell32.shell (); Shell32.folder Folder=Sh.             NameSpace (Shell32.ShellSpecialFolderConstants.ssfCONTROLS); Try             {                 //all options to access the control Panel                foreach(Shell32.folderitem myiteminchfolder. Items ()) {//go to network connection                    if(Myitem.name = =Network) {Shell32.folder FD=(Shell32.folder) Myitem.getfolder; foreach(Shell32.folderitem fiinchFD. Items ()) {//Find Local Area Connection                            if(FI. Name = =networkconnection)) {                                 //Find all right-click menus for local connections                                foreach(Shell32.folderitemverb Fibinchfi. Verbs ()) {if(Fib.name = =Sverb)                                         {Fib.doit (); return true;                 }                                 }                             }                         }                     } }             }             Catch(Exception e) {Console.WriteLine (e.message); return false; }             return true; } 

Source: http://blog.csdn.net/leon_ice/article/details/4426278

Shell32.dll Control Network

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.