locked
Call Control panel / printers from a vb program RRS feed

  • Question

  •  

    This is the code that I am using, does any one know what I am doing wrong
    Dim
    procID As Integer

    procID = Shell(

    "Control panel\printer", AppWinStyle.NormalFocus)

    Friday, June 26, 2009 8:14 PM

Answers

  • This code brings up the dialog from the control panel:

                ' Displays the Control Panel Printers dialog
                'http://www.2x.com/forums/viewtopic.php?p=9906
                Dim proc As New System.Diagnostics.Process()
                proc.StartInfo.FileName = "rundll32.exe"
                proc.StartInfo.Arguments = "shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder"
                proc.Start()
    The link in the comment has the list of all of the different arguments for the different control panel features.

    Hope this helps.
    www.insteptech.com
    We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
    Friday, June 26, 2009 8:44 PM

All replies

  • Shell is expecting that the first parameter is the path to an executable. You would need to find the executable required to display the control panel to get this to work.

    Hope this helps.
    www.insteptech.com
    We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
    Friday, June 26, 2009 8:23 PM
  • do you need the control panel, or just the printers? I assume you want to actually print something, not just see the printers installed?

    if just the printers, you can use a PrintDialog:


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim pbd As New PrintDialog
            pbd.ShowDialog()
        End Sub
    Friday, June 26, 2009 8:37 PM
  • This code brings up the dialog from the control panel:

                ' Displays the Control Panel Printers dialog
                'http://www.2x.com/forums/viewtopic.php?p=9906
                Dim proc As New System.Diagnostics.Process()
                proc.StartInfo.FileName = "rundll32.exe"
                proc.StartInfo.Arguments = "shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder"
                proc.Start()
    The link in the comment has the list of all of the different arguments for the different control panel features.

    Hope this helps.
    www.insteptech.com
    We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
    Friday, June 26, 2009 8:44 PM
  • I just but your code in and it works great.  Thanks for your help
    Saturday, June 27, 2009 12:41 AM
  • Thanks for your reply, I tried your code and it works great. Thanks again
    Saturday, June 27, 2009 12:51 AM