|
-
Dec 7th, 2008, 08:43 AM
#1
Thread Starter
PowerPoster
[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.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Dec 7th, 2008, 09:30 AM
#2
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.
Last edited by RhinoBull; Dec 7th, 2008 at 10:46 AM.
-
Dec 7th, 2008, 10:03 AM
#3
Re: Selecting Default Printer in Control Panel
 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
-
Dec 7th, 2008, 10:47 AM
#4
Re: Selecting Default Printer in Control Panel
Last edited by RhinoBull; Dec 7th, 2008 at 11:02 AM.
-
Dec 7th, 2008, 04:45 PM
#5
Thread Starter
PowerPoster
Re: Selecting Default Printer in Control Panel
 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.
Last edited by Keithuk; Dec 8th, 2008 at 07:20 AM.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Dec 8th, 2008, 07:21 AM
#6
Thread Starter
PowerPoster
Re: Selecting Default Printer in Control Panel
Thanks RhinoBull it works great, topic [Resolved]
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|