GFSetOSDefaultPrinter/Mfrm.frm
VERSION 5.00
Begin VB.Form Mfrm
Caption = "Form1"
ClientHeight = 3135
ClientLeft = 60
ClientTop = 345
ClientWidth = 4695
LinkTopic = "Form1"
ScaleHeight = 3135
ScaleWidth = 4695
StartUpPosition = 3 'Windows‑Standard
Begin VB.ListBox List1
Height = 2400
Left = 60
TabIndex = 1
Top = 60
Width = 4515
End
Begin VB.CommandButton Command1
Caption = "Set Default Printer"
Height = 375
Left = 1920
TabIndex = 0
Top = 2640
Width = 2655
End
End
Attribute VB_Name = "Mfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'(c)2001 by Louis.
Private Sub Form_Load()
'on error resume next
Dim TempPrinter As Printer
List1.Clear 'reset
For Each TempPrinter In Printers
List1.AddItem TempPrinter.DeviceName
Next TempPrinter
End Sub
Private Sub Command1_Click()
'on error resume next
If Not (List1.ListIndex = True) Then 'verify
Call GFSetOSDefaultPrinterfrm.GFSetOSDefaultPrinter_SetOSDefaultPrinter( _
List1.List(List1.ListIndex))
End If
End Sub
[END OF FILE]