Computing.Net > Forums > Programming > VB6 & control panel

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB6 & control panel

Reply to Message Icon

Name: dripster82
Date: August 16, 2003 at 16:00:16 Pacific
OS: Win XP
CPU/Ram: Athlon2400+/512Mb
Comment:

How do i open control panel windows using VB6 ?



Sponsored Link
Ads by Google

Response Number 1
Name: egkenny
Date: August 16, 2003 at 19:01:58 Pacific
Reply:

You can use the shell command to open the Control Panel.

You can also run individual Control Panel dialogs. Many of these are cpls in the C:\Windows\system32 directory

Examples of cpl programs:
appwiz.cpl     Add/Remove Programs Applet
hdwwiz.cpl     Hardware Wizard Applet
main.cpl     Mouse and Keyboard Applet
modem.cpl     Modem and Phone Applet
ncpa.cpl     Network and connectivity Applet

Examples using VB6:

' Open Control Panel
Private Sub ControlPanelButton_Click()
    Dim Command As String
    Command = "rundll32.exe shell32.dll,Control_RunDLL"
    result = Shell(Command, vbNormalFocus)
End Sub

' Open Add Printer Dialog

Private Sub AddPrinterButton_Click()
    Dim Command As String
    Command = "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL 
AddPrinter"
    result = Shell(Command, vbNormalFocus)
End Sub

' Open Keyboard Dialog

Private Sub KeyboardButton_Click()
    Dim Command As String
    Command = "rundll32.exe shell32.dll,Control_RunDLL 
main.cpl @1,,2"
    result = Shell(Command, vbNormalFocus)
End Sub

References:

VBnet Visual Basic Developers Resource Centre
http://www.mvps.org/vbnet/welcome.htm

Adding Control Panel Functions to a VB Application
http://www.mvps.org/vbnet/index.html?code/system/controlpnl.htm

The Win32 Rundll and Rundll32 Interface
http://www.mvps.org/vbnet/index.html?code/system/rundll32.htm

Hide Control Panel Applets
http://www.winguides.com/registry/display.php/909/


0

Response Number 2
Name: Infinite Recursion
Date: August 17, 2003 at 21:41:13 Pacific
Reply:

If you just want to open the control panel... try this..

Shell("control")

Infinite Recursion


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB6 & control panel

Control Panel Applet Dialog Control www.computing.net/answers/programming/control-panel-applet-dialog-control/3916.html

control panel www.computing.net/answers/programming/control-panel-/19227.html

VB6 + Access2K mdb not compatible? www.computing.net/answers/programming/vb6-access2k-mdb-not-compatible/3826.html