Programmatic Interaction with Control Panel Using VS.Net 2005

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:-

 

Cpl.gif

Up Next
    Ebook Download
    View all
    Learn
    View all