ARTICLE

Launching System Applets in VB.NET

Posted by Vishal Kulkarni Articles | Visual Basic 2010 May 24, 2004
This piece demonstrates the use of the shell statement in VB.NET. Various system calls are made using the Shell function.
Download Files:
 
Reader Level:

Description:

This piece demonstrates the use of the shell statement in VB.NET. Various system calls are made using the Shell function. 

In many applications user is given the privilege to change the system settings. This code calls various system dialog boxes such as,

  • Accessibility options (General, keyboard, display, sound etc.),
  • Regional settings (Background, appearance, screensaver , settings),
  • Internet settings dialog box ,
  • Control Panel itself etc.

Procedure:

On running this code a form is displayed. It has many options buttons. Depending on the selection the Applet is displayed. Close the previously opened dialog box to open the new one. 

Source Code:

To launch the Accessibility Options applet:

  • General
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,5

  • Display
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,3

  • Keyboard
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,1

  • Mouse
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,4

  • Sound
    rundll32.exe shell32.dll,Control_RunDLL access.cpl,,2

To launch the Regional Settings applet:

  • Background
    rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0

  • Appearance
    rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,2

  • Screen Saver
    rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1

  • Settings
    rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3
     etc…

Additional information:

When using the Shell command to launch a Control Panel applet, you must be careful to use the exact syntax for the RunDLL32 utility. The capitalization of all components in the statement must not be altered in any way-otherwise, an error will occur.

Each time you want to launch a Control Panel applet, your Visual Basic statement must include the syntax used above. In other words, you need only to substitute the name of the .CPL file for "main.cpl" used above and specify the number of the particular applet you want to execute. Also, if that applet requires additional command-line parameters, you would specify these as the last parameter to the statement.

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Team Foundation Server Hosting
Become a Sponsor