[RESOLVED] Selecting Default Printer in Control Panel
Ok guys/gals.
Now I've made apps for a number of years for work. Now some of these allow the user to print some data out. Rather than using a CommonDialog (which means an extra control) so they can select which printer, I've always printed to the default printer which isn't a problem. Now on our college network we can have 10 printers on each computer. Now if the user sets up the default printer they want to use then no problem, but they don't.
Now on Win9x/ME I can use
Call Shell("rundll32.exe shell32.dll,Control_RunDLL main.cpl @2", 1)
without a problem. This will show the printers in Control Panel and they can just right-click and set as default. I can't get this to work on Win2k/XP. It doesn't even show any errors. Does anyone know the correct code for showing the printers on WinNT. I've search this forum but no obvious answer comes back.
Thanks. ;)
Re: Selecting Default Printer in Control Panel
For Win2K/XP try this:
Code:
Private Sub Command1_Click()
Dim shellCommand As String
shellCommand = "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder"
Shell shellCommand, vbNormalFocus
End Sub
I don't have WinNT4 so I can't test but I think your command should work on NT4 system.
Re: Selecting Default Printer in Control Panel
Quote:
Originally Posted by RhinoBull
For Win2K/XP try this:
Code:
Private Sub Command1_Click()
Dim shellCommand As String
shellCommand = "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder"
Shell Command, vbNormalFocus
End Sub
Shouldn't that be, Shell shellCommand, vbNormalFocus
Re: Selecting Default Printer in Control Panel
Re: Selecting Default Printer in Control Panel
Quote:
Originally Posted by RhinoBull
For Win2K/XP try this:
Code:
Private Sub Command1_Click()
Dim shellCommand As String
shellCommand = "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder"
Shell shellCommand, vbNormalFocus
End Sub
Thank you RhinoBull I will make a simple app and try it out tomorrow. I haven't bothered with the shellCommand no point I've just use.
Shell "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder", vbNormalFocus
I works perfect on Win98SE just the same as my last code did so it should work on WinXP. I called it WinNT because most system are either Win2k. WinXP or Vista so they are all NT, sorry for calling them all NT.
Thanks again. ;)
Re: Selecting Default Printer in Control Panel
Thanks RhinoBull it works great, topic [Resolved] ;)