Programmatic Interaction with Control Panel using VS.Net 2005

来源:互联网 发布:ip与mac绑定设置 编辑:程序博客网 时间:2024/05/15 20:22
Programmatic Interaction with Control Panel using VS.Net 2005

This is simple sample on using Shell and some of its methods. Provided code will open windows that represent Control Panel’s applications. It’s just demonstration on shell usage.

Technologies: .NET Framework,Visual Studio 2005 Total downloads : 3 Total page views :  158 Rating :            0/5 This article has been rated :  0 times User Level : Beginner         Rate this article Read/Post comments       Printable Version  
 

Download Files BrowseControlPanel.zip[65.45 kb]
Advertise here

     
 

   

 

The Microsoft Windows User interface (UI) provides users with access to a wide variety of objects necessary for running applications and managing the operating system. The most numerous and familiar of these objects are the folders and files that reside on computer disk drives. There are also a number of virtual objects that allow the user to do tasks such as sending files to remote printers or accessing the Recycle Bin. The Shell organizes these objects into a hierarchical namespace, and provides users and applications with a consistent and efficient way to access and manage objects.

 

The normal location of this file is C:/windows/system32/shell32.dll

 

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System;

// this is COM component that can be found under the name "Microsoft Shell Controls And Automation"

// this must be added to project references

using Shell32;

 

        Shell objshell = new Shell(); 

        private void Form1_Load(object sender, EventArgs e)

        {

            listBox2.Items.Add("access.cpl");

            listBox2.Items.Add("appwiz.cpl");

            listBox2.Items.Add("btcpl.cpl");

            listBox2.Items.Add("desk.cpl");

            listBox2.Items.Add("directx.cpl");

            listBox2.Items.Add("hdwwiz.cpl");

            listBox2.Items.Add("inetcpl.cpl");

            listBox2.Items.Add("intl.cpl");

            listBox2.Items.Add("irprops.cpl"); 

        }

 

 

Start the Control Panel Application:-

 

objshell.ControlPanelItem(listBox2.SelectedItem.ToString());

 

Output:-

 

 



原创粉丝点击